-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
OAuth2 grant type refresh_token
sends the access token when no refresh token is available
#826
Comments
The source of the HTTP 401 error is a malformed request. social-auth-core is sending this sort of request (a few headers are omitted)
and getting this sort of response (again some headers are omitted).
If the requests are modified so that they look like it is described in RFC6749
then everything works smoothly. |
The request really looks wrong. Reading the code, it ends up calling |
@nijel Sorry, you are right. This was true on Sep 6 2023, but I checked now and the request is properly constructed. I paid attention only to the status code of the error I was seeing and did not realize that while the status code coincides, the error message is actually different. What I am observing now is a different problem. |
refresh_token
sends the access token when no refresh token is available
@nijel We spotted the actual issue, I just edited the title and updated the initial message. |
@bgruening FYI |
This logic is there since ever (a7f8ff4), I'm not sure if removing fallback to access_token will not break something. |
Expected behaviour
According to RFC6749 section 4.1.4, when requesting an authorization code via OAuth2 (
grant_type=authorization_code
) using a request like this,the response may contain a
refresh_token
.If the response contains no
refresh_token
and laterrefresh_token()
is called, I would expectsocial-core
to raise an exception (or at least not send a request to the authorization server).Actual behaviour
social-core
sends the access token as if it was a refresh token and the authorization server reports that the refresh token is invalid.What are the steps to reproduce this issue?
Request an authorization code via OAuth2 to an authorization server that does not return a
refresh_token
(for example, LS Login). Then callrefresh_token()
.Any logs, error output, etc?
The authorization server returns a response with error code 401.
The error is arising in version 4.5.4.
Any other comments?
We have spotted this issue on UseGalaxy.eu, that makes use of LS Login in production. This problem arises about one hundred thousand times a day since September 1, 2023.
The text was updated successfully, but these errors were encountered: