-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session not being persisted when I close the browser #1131
Comments
@balazsorban44 This might be related to the new Fauna adapter that is in the works. Here is my fauna adapter file - https://github.com/pbteja1998/nextjs-starter/blob/master/src/adapters/fauna/index.ts Copied directly from #708 EDIT: Edit2: |
Yeah, I guess it is some kind of calculation issue on the session age. I think the session age is somehow set to a lower value than the current date, in that case, the max-age will be set to |
Where is this calculation being done? Is it in the fauna adapter file or in some other file in next-auth codebase? |
In the adapter, the one you just linked. I would check the Also, here is the code being called when calling the next-auth/src/server/routes/session.js Lines 61 to 94 in 78fd783
As you can see, this should update the cookie expiry whenever session is accessed. In case the sessionToken was found but invalid, the cookie will be removed. So I would also check the (Hint: add |
Ok, thanks. Will try to debug. If you are able to figure it out before me, please update it here. |
Found it in the below line. It should be |
Changing it like above did not fix it. |
@balazsorban44 I was able to fix it. Thanks for pointing out the relevant code. Here is the diff: |
Awesome! |
@balazsorban44 yeah I'd say update that file in the fauna adapter. This only affects that adapter, right? Good work @pbteja1998! |
As far as I know. (haven't tested other adapters). @pbteja1998 then we would be glad to accept a PR from you to fix this! 🙂 |
I'm on it. |
@balazsorban44 Opened the PR at #1134 |
Hi, Is there a way to persist the session? As soon as I close the browser, the user is being logged out.
When I saw the cookies that are set, I see
Expires/Max-Age
value ofnext-auth.session-token
set toSession
. I am using the default configuration. By default, I assumed the max-age will be set to 30 days as per documentation. But that doesn't seem to be the case. Am I missing something?The text was updated successfully, but these errors were encountered: