[GH-ISSUE #369] [Multisession cookie not persistent] #8238

Closed
opened 2026-04-13 03:20:02 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @Kevinvincentals on GitHub (Oct 30, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/369

Originally assigned to: @Bekacru on GitHub.

Describe the bug
A clear and concise description of what the bug is.
Multi-session does not work correctly as expected. The cookie is upon login is set correctly but removed quickly after. Tested in NextJS 15

To Reproduce
Steps to reproduce the behavior:

  1. Do a fresh install of NextJS 15
  2. Install better-auth and follow documentation to get auth flow working
  3. Install the plugin for multi-session and enable it
  4. Login and look in cookies

Expected behavior
It should set a cookie for each multi user thats logged in and keep it there

Additional context
Created a thread with another user in the discord. The user there also provided screenshots + a video showing the issue

Originally created by @Kevinvincentals on GitHub (Oct 30, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/369 Originally assigned to: @Bekacru on GitHub. **Describe the bug** A clear and concise description of what the bug is. Multi-session does not work correctly as expected. The cookie is upon login is set correctly but removed quickly after. Tested in NextJS 15 **To Reproduce** Steps to reproduce the behavior: 1. Do a fresh install of NextJS 15 2. Install better-auth and follow documentation to get auth flow working 3. Install the plugin for multi-session and enable it 4. Login and look in cookies **Expected behavior** It should set a cookie for each multi user thats logged in and keep it there **Additional context** Created a thread with another user in the discord. The user there also provided screenshots + a video showing the issue
GiteaMirror added the lockedbug labels 2026-04-13 03:20:02 -05:00
Author
Owner

@Bekacru commented on GitHub (Nov 1, 2024):

It would be helpful if you could provide a reproducible project I can review. Just a thought—in case you're trying to sign out and then sign in to a different account, signing out might be clearing all session cookies, including multi-account cookies

<!-- gh-comment-id:2451416380 --> @Bekacru commented on GitHub (Nov 1, 2024): It would be helpful if you could provide a reproducible project I can review. Just a thought—in case you're trying to sign out and then sign in to a different account, signing out might be clearing all session cookies, including multi-account cookies
Author
Owner

@Kevinvincentals commented on GitHub (Nov 1, 2024):

It would be helpful if you could provide a reproducible project I can review. Just a thought—in case you're trying to sign out and then sign in to a different account, signing out might be clearing all session cookies, including multi-account cookies

Hello.
I have two options

  1. I Can give you access to the current codebase running for my project where the issue happenfs
  2. I just setup a fresh install / nextjs 15 with better Auth and it has same outcome, by simply following Docs:
    Get started
    -> installation
    -> basic usage
    Using mysql with Prisma

Only doing e-mail password combo

About the cookie clearing- the multi cookie is not even being set upon login, so if it cleared when logging out - I dont Think thats an issue.

The multi cookie is set upon login and cleared in the same second

<!-- gh-comment-id:2451424769 --> @Kevinvincentals commented on GitHub (Nov 1, 2024): > It would be helpful if you could provide a reproducible project I can review. Just a thought—in case you're trying to sign out and then sign in to a different account, signing out might be clearing all session cookies, including multi-account cookies Hello. I have two options 1. I Can give you access to the current codebase running for my project where the issue happenfs 2. I just setup a fresh install / nextjs 15 with better Auth and it has same outcome, by simply following Docs: Get started -> installation -> basic usage Using mysql with Prisma Only doing e-mail password combo About the cookie clearing- the multi cookie is not even being set upon login, so if it cleared when logging out - I dont Think thats an issue. The multi cookie is set upon login and cleared in the same second
Author
Owner

@AlfredoAlessandro commented on GitHub (Nov 1, 2024):

I have the same problem, here I can show how my application looks like

https://github.com/user-attachments/assets/70e81932-0002-4593-bbf2-5768e57baec3

<!-- gh-comment-id:2452714658 --> @AlfredoAlessandro commented on GitHub (Nov 1, 2024): I have the same problem, here I can show how my application looks like https://github.com/user-attachments/assets/70e81932-0002-4593-bbf2-5768e57baec3
Author
Owner

@Bekacru commented on GitHub (Nov 7, 2024):

Hey guys, I was just taking a look at this today. I’m still unable to reproduce the issue, so if you could make a public repo for me to review, that would be great.

<!-- gh-comment-id:2461608300 --> @Bekacru commented on GitHub (Nov 7, 2024): Hey guys, I was just taking a look at this today. I’m still unable to reproduce the issue, so if you could make a public repo for me to review, that would be great.
Author
Owner

@Kevinvincentals commented on GitHub (Nov 7, 2024):

Hey guys, I was just taking a look at this today. I’m still unable to reproduce the issue, so if you could make a public repo for me to review, that would be great.

Hi Bekacru
Thank you for looking into this issue.

i will give this a try on my project again to see if the issue persists. Maybe a update has fixed it?
I'll let you know.

<!-- gh-comment-id:2461630818 --> @Kevinvincentals commented on GitHub (Nov 7, 2024): > Hey guys, I was just taking a look at this today. I’m still unable to reproduce the issue, so if you could make a public repo for me to review, that would be great. Hi Bekacru Thank you for looking into this issue. i will give this a try on my project again to see if the issue persists. Maybe a update has fixed it? I'll let you know.
Author
Owner

@Bekacru commented on GitHub (Nov 16, 2024):

Hey guys this should be fixed starting from 0.8.5

<!-- gh-comment-id:2480483527 --> @Bekacru commented on GitHub (Nov 16, 2024): Hey guys this should be fixed starting from `0.8.5`
Author
Owner

@Bekacru commented on GitHub (Nov 16, 2024):

feel free to re-open if not

<!-- gh-comment-id:2480483555 --> @Bekacru commented on GitHub (Nov 16, 2024): feel free to re-open if not
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8238