django-social-oauth-token
Installation •
Contributing •
How To Use •
License
OAuthToken generation API for handling OAuth 2.0 Authentication Code Flow based on social-auth
Installation
- Use your preferred package manager (pip, poetry, pipenv) to install the package. For example:
$ poetry add django-social-oauth-token
- Then register 'social_oauth_token', in the 'INSTALLED_APPS' section of your project's settings.
...
INSTALLED_APPS = (
...
'social_oauth_token',
)
...
- Include the
urlpatterns
in your main urls
file.
urlpatterns = [
...
path("social_oauth_token/", include("social_oauth_token.urls", namespace="social_oauth_token")),
...
]
How To Use
In order to verify the Authorization Code sent by the user and replace it with your own OAuth Access Token, send a POST request to the token/<backend>/
endpoint with client_id
and code
to receive the token.
The POST request parameters:
client_id
code
The JSON response:
{
"access_token": <access_token>,
"expires_in": <expires_in>,
"token_type": <token_type>,
"refresh_token": <refresh_token>,
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
MIT License