How to update session for credentials provider with custom backend? #979
Unanswered
jaekunchoi
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have custom backend that provides JWT and also using credentials provider in NextAuth. I also want to ensure session expiry is updated (with JWT expiry updated) whenever user makes a request with Axios. I can intercept request at
_document.js
.It seems Next Auth encodes JWT token retrieved from backend again with another JWT token. So when I decode, I get JWT token for the backend server that was generated from. The problem is I have to work with two expiry and update both the custom backend server with new JWT and expiry then on Next Auth with new JWT and expiry.
I think I can do this with
jwt
callback but how can I invoke this fromgetInitialProps
in_document.js
where I can intercept the request/response before and after custom backend request?Beta Was this translation helpful? Give feedback.
All reactions