-
Notifications
You must be signed in to change notification settings - Fork 818
Open
Description
Opening a new issue from #638 investigation.
Context:
AccessToken expose an API to revoke them: revoke().
I use that when a user does an explicit logout to make sure that the token is invalidated (we can argue whether this is really necessary from a security point of view, but...)
The issue:
revoke() actually just deletes the AccessToken in the db.
Yet, we might still have an associated refresh token.
When trying to use it, it will look for the linked access token to find the scopes associated with the "connection" and will crash when it does not find anything (DoesNotExist AccessToken)
Proposition:
- do not delete the token from the db, rather just update the "expires" attribute to invalidate it (and let the
clear_token()function deal with the deletion when it's safe only) - do not delete the token from the db, mark it as revoked (and change the token validation code to recognize a new
revokedattribute) - delete the
RefreshTokenat the same time. From my point of view, if the user voluntarily logs out, it's ok to kill hisRefreshTokenbut I'm not sure whether there are other more complex scenari to consider.
Do you agree? which do you prefer? I'm happy to take a crack at it and provide a PR
kamilkijak
Metadata
Metadata
Assignees
Labels
No labels