Skip to content
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

Support revoking the session inside the refreshSession override #744

Open
porcellus opened this issue Nov 16, 2023 · 1 comment
Open

Support revoking the session inside the refreshSession override #744

porcellus opened this issue Nov 16, 2023 · 1 comment

Comments

@porcellus
Copy link
Collaborator

Currently if you revoke the session in a refreshSession function override it still returns 200 and sets the session tokens in the response, while doing the same in the API override will not set the tokens.
This is because the session object doesn't save the fact that it has been revoked and the default API impl can set the tokens in the response.

If the user wants to deny refreshing the session they should throw an UNAUTHORISED error after revoking the session.

Internal discussions: https://supertokens.slack.com/archives/C03J31QAQLC/p1699977428029849
Summary: this can be fixed by making revokeSession save the "revocation" on the session object and to make attachSession.. and the refreshSession API impl handle it appropriately. Although the current impl is not ideal, we decided to postpone fixing, since there is a straightforward "workaround" and it's a rare use-case anyway.

@rishabhpoddar
Copy link
Member

This can also be achieved by overriding the api layer instead of the functions layer, and revoking the session after calling the original implementation of the refresh API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants