sebastian
BABetter Auth
•Created by sebastian on 5/11/2025 in #help
Weird behavior when rememberMe is false.
When logging in with
rememberMe: false
, the session cookie is created and stored correctly (verified in browser + DB), but /v1/session
(or /api/auth/get-session
) returns null. With rememberMe: true
, everything works fine. Both od the endpoints returns the session.
What i've tried:
Cookies are correctly set (better-auth.session_token, dont_remember
) and sent with credentials: "include"
.
Headers forwarded correctly in /v1/login
, including Set-Cookie
.
Tried removing secure, no change.
Session exists in the DB.
When visiting /v1/session
, still getting null.
I'm using Next.js as the frontend and the Hono as separate backend where better auth is running.
Here's the login route:
2 replies
BABetter Auth
•Created by sebastian on 5/7/2025 in #help
getting unauthorized in production but locally works flawless
Hello. Im trying to implement a user check in one of my api endpoints in Hono to prevent abuse.
The whole auth flow was setup on nextjs side (logging in, signing up etc.). But i neeed separate backend to manage high uploads.
And the problem rises when trying to fetch that protected endpoint. I fetch it client-side with credentials "include" to attach the cookies. After fetching, i always get 401, and the credentials are set to "omit" for some reason. This didn't happen in local.
Here's the fetch call:
Here's the server configuration:
And heres the endpoint: /v1/auth/upload:
9 replies