Skip to content

Commit 392257a

Browse files
rudolfolahauvipy
authored andcommitted
getting_started.rst: add JSONOAuthLibCore as part of tutorial (#734)
I had trouble getting `grant_type=password` working with the Django REST Framework example in the DOT tutorial. The answer was to set the OAuth2 backend class to `'oauth2_provider.oauth2_backends.JSONOAuthLibCore'`: #127 (comment) I was trying to use Angular framework with its HttpClient and I think the POST requests were sending over content with `application/json`. It would have been a better experience to see this documented in the tutorial.
1 parent f86dfb8 commit 392257a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/rest-framework/getting_started.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ Also add the following to your `settings.py` module:
100100
.. code-block:: python
101101
102102
OAUTH2_PROVIDER = {
103+
# parses OAuth2 data from application/json requests
104+
'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore',
103105
# this is the list of available scopes
104106
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
105107
}
@@ -112,6 +114,10 @@ Also add the following to your `settings.py` module:
112114
)
113115
}
114116
117+
`OAUTH2_PROVIDER` setting parameter sets the backend class that is used to parse OAuth2 requests.
118+
The `JSONOAuthLibCore` class extends the default OAuthLibCore to parse correctly
119+
`application/json` requests.
120+
115121
`OAUTH2_PROVIDER.SCOPES` setting parameter contains the scopes that the application will be aware of,
116122
so we can use them for permission check.
117123

0 commit comments

Comments
 (0)