Replies: 1 comment 1 reply
-
similar issue here! |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Description 📓
Problem statement
@balazsorban44 @ThangHuuVu This requirement arises because of we using credentials provider with auth functionality provided by our own backend. Due to maxAge being rotational it leads to 'page jump' problem in our application.
Our backend API provides me JWT token along with its expiry time (which is stored in the NextAuth session). Now what happens is that whenever user visits the page -
Now the problem with the above is that the user is allowed to see our auth related pages for a while (until the data is being loaded) and then suddenly as soon as frontend knows that the token has expired... user is logged out and thus being redirected to login page. This leads to page jump and thus a very bad user experience (also as 401 is an error response, the user sees error message for a few secs, in each component where API call is made (until he is eventually logged out). This worsens the UX further).
I feel maybe people in the below issues are also facing the same issue -
Custom session expire date #2790
Proposed solution
I feel this can be solved just if the maxAge/expires can be fixed to the date and time provided by our API (this can be an opt-in option). If this feature is provided, the flow of our app (explained in the problem statement above) will become as follows -
PS: Please feel free to correct me if you find a gap in my understanding as I am relatively inexperienced
How to reproduce ☕️
Sorry, Can't help with this
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
Beta Was this translation helpful? Give feedback.
All reactions