NextAuth Refresh Access Token Rotation Doesn't Work In Production
Unanswered
Carolina Dog posted this in #help-forum
Carolina DogOP
So as we know, google access token expires in 1 hour (3600 seconds). So if I want my session to be 1 day (24 hours), the access token has to be revalidated because It's only valid in an hour.
I tried this guide below but it only works on local run dev + run build. It doesn't work in production.
https://authjs.dev/guides/basics/refresh-token-rotation
I tried googling and ChatGPT but I also couldn't get my answer.
when I pass the error to session and console.log it in useEffect(), It says that "error invalid grant type (In Production env). I'm deploying on vercel.
Here is a screenshot of my code and the log error that I pass into the session client.
Anyone has experience on this one? Thanks alot.
I tried this guide below but it only works on local run dev + run build. It doesn't work in production.
https://authjs.dev/guides/basics/refresh-token-rotation
I tried googling and ChatGPT but I also couldn't get my answer.
when I pass the error to session and console.log it in useEffect(), It says that "error invalid grant type (In Production env). I'm deploying on vercel.
Here is a screenshot of my code and the log error that I pass into the session client.
Anyone has experience on this one? Thanks alot.
7 Replies
Carolina DogOP
Oh yea, this is the console.log() message. Thank you.
@Carolina Dog - I'm getting the same error. Were you able to solve it?
@evro <@348294011368374285> - I'm getting the same error. Were you able to solve it?
Carolina DogOP
What version of nextjs are you using rn? I haven't tried it in the latest NextJS version
next v 13.4.13 / nextauth 4.22.4
@evro next v 13.4.13 / nextauth 4.22.4
Carolina DogOP
I think the error is on vercel.
@evro next v 13.4.13 / nextauth 4.22.4
Carolina DogOP
If you have found a fix to this, please let me know! Thank you
@Carolina Dog If you have found a fix to this, please let me know! Thank you
following up, I still have issues with this. Please let me know if you have solved this issue.