Open paulschneider opened 3 days ago
There is a small window of time where an expired JWT will still be accepted. I don't recall the exact timeframe though - maybe 30 seconds? How long are you waiting before you try the expired JWT?
Err... I was wrong there. I was thinking of the refresh token being able to be used more than once.
Calling setSession
with an expired access_token and a valid refresh_token will cause the session to be refreshed, giving you a valid access_token for your query.
If you want to avoid this, then I'd manually set the client's authorization header when creating the client, instead of using setSession.
Bug report
Describe the bug
It is possible to use the JS library to make a call to "database.update" and have requested changes commit to the table using an expired JWT. Making a check of session.getUser() returns a null value indicating that the user is not authenticated but the underlying operation to make the update is successful.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
[In the context of a NestJS API]
Expected behavior
The database change (or any operation requiring an authenticated user) should be denied and not occur.
System information
Additional context