Better AuthBA
Better Auth10mo ago
7 replies
Xirynx

Authentication with Express backend + Next.js frontend

This is my first time using Better Auth, so forgive me if this is obvious 😅

I have an existing backend built with Express, which has Better Auth setup and running.

We are creating a new Next.js frontend, on a separate server, which needs to authenticate against this backend.

After reading the docs, seems like authenticating on the Next.js client side is fairly simple using the
better-auth/react
package, but trying to get the session on the Next.js server side requires importing the
auth
instance, which I cannot access since its on our Express backend.

What is the solution if I need to make a server side fetch to our Express backend?
Solution
Integrate Better Auth with Next.js.
Next.js integration | Better Auth
Was this page helpful?