-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unsupported_grant_type on rest example #807
Comments
The normal tutorial also mentions that it needs a valid redirect url, but the REST tutorial says nothing about it. |
In your settings.py, do you have any configuration like that? |
I have the same error as you. Did you fix the error? |
@baranberkay96 yep |
@dnjscksdn98 nope |
After I deleted |
The default value in @rudolfolah Can you take a look at this and see if you can find a fix to your error that doesn't break other instances and submit a PR? Meanwhile, I'll go ahead and revert this PR for 1.3.1. The documented token endpoint POST in RFC 6749 appears to always use In scanning the code, I see JSONOAuthLibCore was added in ab1f7ab but no usage or other documentation of it at all, some I'm a bit confused. |
Commented on the PR: my suggestion is to revert the example but leave the documentation and add on to the documentation to mention that the content-type header should be set. |
After I removed the OAUTH_PROVIDER in the settings, it worked. But I can't get 1. Authorization code [GET] and 2. Exchange the code for access token [POST] using json request. Any idea on how to go about that? I want the flow to be via json not visiting the link directly. |
For example, to get the AUTH CODE, I did this:
I got the below response:
|
Take a close look at the Location: header in the 301 response. You need your original request to have a trailing slash and then you won't get a redirect. |
I added the trailing slash and it got blocked by django auth (login_required).
|
I found out that redirection will happen upon GET request, so what I needed to do is to send a POST request to /o/authorize/ with the required params to get an auth_code. I did that but got a 403 error code. It's there any url that accepts json as body for this? |
@dnjscksdn98 Default
When you use There is lack of information about how it's going to effect usage of I found out how it works as I mention above and it worked for me. I could open PR to update docs if it works for your case. please let me know. |
I believe the use of JSON body rather than form-encoded in this case is not supported by the OAuth spec, so you are using it incorrectly with a JSON body. Sorry but see the OAuth 2.0 RFC 6749. "Fixing" your oauth server to implement something non-standard is not the right way to do this. |
Describe the bug
Doing the rest example with:
doesn't work and simply returns this error:
{"error": "unsupported_grant_type"}
and this in the log:
To Reproduce
Do the example
Expected behavior
It should work.
Version
Additional context
Quite hard to believe this, honestly.
The text was updated successfully, but these errors were encountered: