Replies: 2 comments
-
|
I have the same requirement. I was thinking of manually calling the jwt callback by retrieving the options. |
Beta Was this translation helpful? Give feedback.
-
|
I have the same problem and I think there is no solution to this at the moment which is frustrating. The only workaround I think is to add a refresh token logic in the api yourself. Basically, call that refreshToken function manually if API route returns 401 and you still have a refreshToken. If you use getServerSession function instead of getToken function, it runs your jwt callback everytime you call the session. So it solves the problem but you have to expose the accessToken in the session this way which is a security issue itself. Is there any plan to fix this at all or if there is a solution I would like to hear about it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
First, I have a catch-all proxy in
pages/api/proxy/[...all].tsthe purpose of this is to attach the access token to theAuthorization: Bearer ${accessToken}header for all our api calls.To do this I have to get the token inside this proxy and attach it using
const token = await getToken({ req, secret })I have the Refresh token rotation implemented and working fine. Now the problem is: when this token is expired the
getToken()is not waiting for it to renew or in simpler words it is not checking theJWT callbackwhich inside we check the token expiration. So it results in401error where thegetToken()is still using the old token.How do I solve this when the first thing that user hits when they enter the page is the
getToken()?Beta Was this translation helpful? Give feedback.
All reactions