Provider Auth
Using these endpoints you can authenticate with external tools.
The workflow should look like this:
- Access the endpoint providing a
redirect_uri that would perform the
POST action later.
- The request would return a JSON containing one key
authorization_url.
Redirect the user to that URL.
- When the user authenticates with the external tool, that tool would redirect
them to the
redirect_uri you provided with a GET querystring
containing two arguments: code and state
- From the view that your user got redirected to, issue a
POST request
to the endpoint with the code and state arguments. You should use
application/x-www-form-urlencoded not JSON. The user should be now
authenticated in your application.
The list of providers is available at
social backend docs.
please follow the instructions provided there to configure your backend.
Configure urls.py:
urlpatterns = [
(...),
url(r'^auth/', include('djoser.social.urls')),
]
Default URL: /o/{{ provider }}/
Note
redirect_uri is provided via GET parameters - not JSON
state parameter isn’t always required e.g. in case of OpenID backends
| Method |
Request |
Response |
GET |
|
HTTP_200_OK
HTTP_400_BAD_REQUEST
|
POST |
|
HTTP_201_CREATED
HTTP_400_BAD_REQUEST
|
Social Endpoints¶
Warning
This API is in beta quality - backward compatibility is not guaranteed in future versions and you may come across bugs.
Provider Auth¶
Using these endpoints you can authenticate with external tools.
The workflow should look like this:
redirect_urithat would perform thePOSTaction later.authorization_url. Redirect the user to that URL.redirect_uriyou provided with aGETquerystring containing two arguments:codeandstatePOSTrequest to the endpoint with thecodeandstatearguments. You should useapplication/x-www-form-urlencodednot JSON. The user should be now authenticated in your application.The list of providers is available at social backend docs. please follow the instructions provided there to configure your backend.
Configure
urls.py:Default URL:
/o/{{ provider }}/Note
redirect_uriis provided via GET parameters - not JSONstateparameter isn’t always required e.g. in case of OpenID backendsGETredirect_uriHTTP_200_OKauthorization_urlHTTP_400_BAD_REQUESTPOSTcodestateHTTP_201_CREATEDtokenHTTP_400_BAD_REQUEST