cookiePrefix configured cookie prefix isn't respected #1396

Closed
opened 2026-03-13 08:37:34 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @SohelIslamImran on GitHub (Jun 21, 2025).

If I use cookiePrefix, then I receive null even user is logged in when calling authClient.getSession() to get the user session. But when I remove the cookiePrefix from the advanced config in the backend batter-auth configuration, it works!
I checked the application tab in Chrome debugging tool, it seems like it is using the cookiePrefix to set the cookie, but maybe not using it to read the cookie
Using "better-auth": "^1.2.10",

Originally created by @SohelIslamImran on GitHub (Jun 21, 2025). If I use `cookiePrefix`, then I receive `null` even user is logged in when calling `authClient.getSession()` to get the user session. But when I remove the `cookiePrefix` from the advanced config in the backend batter-auth configuration, it works! I checked the application tab in Chrome debugging tool, it seems like it is using the `cookiePrefix` to set the cookie, but maybe not using it to read the cookie Using "better-auth": "^1.2.10",
GiteaMirror added the bug label 2026-03-13 08:37:34 -05:00
Author
Owner

@Bekacru commented on GitHub (Jun 21, 2025):

Have you logged in with the same cookie prefix?

@Bekacru commented on GitHub (Jun 21, 2025): Have you logged in with the same cookie prefix?
Author
Owner

@SohelIslamImran commented on GitHub (Jun 22, 2025):

@Bekacru Yes, I checked it properly... I had the same cookie prefix I defined in the configuration.

@SohelIslamImran commented on GitHub (Jun 22, 2025): @Bekacru Yes, I checked it properly... I had the same cookie prefix I defined in the configuration.
Author
Owner

@SohelIslamImran commented on GitHub (Jun 22, 2025):

Sorry, now I tried but couldn't reproduce the same issue! I will close this for now

@SohelIslamImran commented on GitHub (Jun 22, 2025): Sorry, now I tried but couldn't reproduce the same issue! I will close this for now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1396