using nexjs as a frontend and expressjs as a backend
I have my auth.ts on my expressjs backend and my auth-client.ts in my nextjs frontend but I want to get user info in my nextjs on server side can I add a second auth.ts file in my nextjs frontend so I will be able to use auth.api.getSession() in server side on my nextjs frontend while keeping the principal auth.ts in my beckend (expressjs) ?
8 Replies
@nikatune do you know the answer ?
is it expressjs is neccesary for your project? maybe you should use api routes on Next.js
the thing is that I have a mobile app with expo that use the expressjs backend too
Yep mine too.
Let's Say have a laravel API using Sanctum for authentication, and my frontend is built with Next.js using Better Auth,
How does Better Auth
handle API credentials in this case, especially the Sanctum token? Is there a way to store and manage the token so it's available across all
Better Auth sessions, for example during SSR or protected routes? I'd really appreciate any guidance or best practices for this setup. Thanks!
It would be better if @Ping answers he knows better than me
Hey @Ping 👋🏻,
Need your expertise on the above questions. Please you can shed some light on this, would help a lot. 🙏🏻🙏🏻
this is the code to get the session on server
stop spamming (making 6 threads) for no reason at all @Gab. Just read the docs, it's not that hard
thank's ! sorry didn't know this was the solutions