This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
NextAuth with external API that provides access and refresh JWT HttpOnly cookies #6544
Labels
question
Ask how to do something or how something works
Question 💬
I'm trying to figure out how the flow works when the API (written in NestJs) provides Authentication cookies.
Here are the authentication endpoints:
/signin sets the Access- (Max-Age: 240) and Refresh token cookie (Max-Age: 60000)
/refresh sets a new Access token Cookie
The UseGuards use the Passport
'jwt'
and'jwt-refresh-token'
guards[...nextauth]
file:Data retrieval
Now most data is retrieved within the getServerSideProps and some of the search data is done on the frontend.
On the getServerSideProps I get it by using:
The getData is an extension on:
So as you can see I pass through the cookies as default
Issue
Signing in seems to work great, navigating between pages also, until my token expires.
After some fiddling I seem to have 2 problems or maybe misunderstandings about the topic:
async jwt()
callback. How should take this on?How to reproduce ☕️
Refresh or navigate page after token expiry
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
The text was updated successfully, but these errors were encountered: