4

I'm trying to implement an authorization via next-auth with a custom provider. But the NextAuth.js doesn't have a refresh token functionality. I have an endpoint for updating the access token but I'm not sure where the correct place (in next-auth config) I should implement it. Could someone help me with this? maybe some info. Thank you! (https://next-auth.js.org/)

Victor
  • 51
  • 1
  • Not sure about next-auth but the idea would be to create a `/refresh` page (so client-side), and redirect to this page if the auth token is expired. Then, this`/refresh` page would do a request to update the token, using the refresh token stored on the cookies, and redirect the user back to the page they were looking (using a `?from=...` query parameter when you redirect for instance). I like this schema a lot: https://github.com/vercel/next.js/discussions/17515 – Eric Burel Mar 04 '21 at 09:15

0 Answers0