user session null
Hi all, I searched and saw a few posts related to my problem but the solution was not enough so I decided to make my own post. I am trying out Better-Auth with Prisma. 
Problem: I don't see user session after signing up or logging in. I am able to see the db populate with the information + session data.
What I'm trying to do:
1. sign up / login
2. redirect to a different page, i.e / -> /setup
3. do stuff.
Here is my current code for the configuration:
6 Replies
which framework did you use? Next.js ?
My apologies I thought I added that in my post, I am using Astro
I made a session endpoint but this just returns false meaning null session.
src/pages/api/auth/session.ts
For future readers, I ended up trying out Clerk for authentication and that worked, thanks
check if the cookie better-auth.session_token has been set, if it does not exist you will always get null back
I tried seting that as well and got null still sadly.
Try setting secure: false in defaultCookieAttributes: { secure: true, httpOnly: true, sameSite: "none", partitioned: true, }, since you are working in dev mode.
Based on the first screenshot, looks like you are using the server  API which means you don't need to setup API endpoint. You need to understand there a 2 way to use better-auth, client and server. If you were logged in using server and accessing the session using the client, it will return empty