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

Identity server handler doesn't handle fetch error due to invalid token #9

Open
juni0r opened this issue Nov 24, 2023 · 0 comments
Open

Comments

@juni0r
Copy link
Contributor

juni0r commented Nov 24, 2023

When the auth/identity handler is invoked with an invalid token, it'll throw an error when trying to fetch the current user. This sends the application in an infinite loop trying to get the identity.

let user = await client.querySingle(`select global current_user;`)

This happened when the access token cookie had been set by another EdgeDB instance running on the same host (localhost:3000). But it would also occur with sessions of the same EdgeDb instance if the auth_signing_key was changed, since that would also cause a JWT signature mismatch.

In order to deal with this gracefully, we need to catch the error when trying to fetch the current user and delete the token cookie.

I'm currently preparing a fix and will submit a PR.

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

1 participant