No JWT Token when using better-auth with Next.js SSR on login
I am using better-auth component for authentication, i have protected routes in
/dashboard
which only allow authenticated users to access. I am using the following wrapper to handle this
But when user logs in, and navigates to dashboard, token is undefined, it is undefined until i manually refresh the page.5 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
so when i log in there is a cookies present called
-
better-auth.session_token
but when i refresh i get these two headers
- better-auth.session_token
- better-auth.convex_jwt
when you say headers you mean cookies right
Recommend checking out the Convex doc for SSR w/ Next.js https://docs.convex.dev/client/react/nextjs/server-rendering
yes cookies, after login i get
session_token
cookie but not convex_jwt
cookie, the jwt cookie comes only when i refreshOh really, what version of @convex-dev/better-auth do you have