-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Fix 500 error for refresh with revoked access token. #620
Fix 500 error for refresh with revoked access token. #620
Conversation
UPDATE: This did in fact fix my issue, and now returns a 4xx instead of a 5xx error. |
fixes jazzband#585 Note that there are no integration tests, so the unit tests don't actually show the 500 error that would have been seen with a call to oauth2_provider/oauth2_backends.py:create_token_response.
924c465
to
fbea0ae
Compare
This doesn't look right... at first glance it should probably be happening in the same transaction as what's happening before. |
@jleclanche: Thanks for looking at this. I'm not sure what "...the same transaction as what's happening before" refers to? Here are a lot more details about the problem. Our original code used django-auth-toolkit 0.12.0. In that version, if you do the following:
When I upgraded to django-auth-toolkit 1.1.2, the behavior had changed, due to an issue I will describe in more detail. For reference for my description below, here are the relevant lines in The problem: What is probably warranted is an integration test that shows the whole flow between Here are additional details of the error I am seeing... Error Message: Relevant stacktrace:
|
@jleclanche: I also did not find any indication that the refresh token should be invalid if the access token is revoked in the RFC. So maybe the refresh token should continue to work as long as it is not revoked? If so, maybe this was a bug in 0.12.0, and we want to correct the behavior? In that case, would the solution be to have the refresh token include the original scopes in its model so it doesn't need to refer back to the (possibly revoked) access token? Other? |
At this time, I think that both the old version (0.12.0) and the new version (1.1.2) have different versions of the same bug. The old version returned a 401. The new version returns a 500. In both cases, this should probably be a 200. I'm going to close this PR, which was just replicating an earlier bug, rather than fixing the issue. |
fixes #585
Note that there are no integration tests, so the unit tests don't
actually show the 500 error that would have been seen with a call
to oauth2_provider/oauth2_backends.py:create_token_response.
Also, there was no coverage for validate_refresh_token. I added some coverage since I was updating it, but I did not add full coverage.