Skip to content
Discussion options

You must be logged in to vote

That is because getServerSession() calls the session() callback which calls the jwt() callback with the decoded token.
While getToken() simply returns the decoded token.

That means that getServerSession() is able to return a value based on a call to jwt() within the same request, although you have to go through session().

However, this should not be a concern at all. Ask yourself what should happen if the browser initiates 2 API requests in parallel, but one of them refreshes the token? Or if the second request starts later but before the response to the first one was received?

The answer is that you refresh tokens a bit ahead of time. There will be a short window when two tokens are vali…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@leodip
Comment options

@hesalx
Comment options

Answer selected by leodip
@leodip
Comment options

@aneeshksoft
Comment options

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