Session Not Persisting in Production (Docker) After Social Login

Hi, The authentication flow using better-auth and social login works perfectly on localhost. When I log in with a social account, the session is correctly created in the database, and the user appears as logged in on the site. However, when I run the same setup in production inside Docker, the session is still created in the database, but the user does not appear as logged in on the website. It's like the session is not being recognized properly in production. Could you help me understand what might be causing this issue in the production environment? Maybe it's related to cookies, domain, or some misconfiguration in Docker?
4 Replies
Ping
Ping4w ago
Hey I'm going to close this as it's solved, right?
FalconiZzare
FalconiZzare3w ago
If you did solve the issue, please let me know what the issue was.
kagann
kagannOP3w ago
check the cookie domain if your backend and client is different its needs to be like .domain.com or yourbackendsub.domain.com
FalconiZzare
FalconiZzare3w ago
I see. BASE URL issue?

Did you find this page helpful?