How to use better-auth as frontend-only authentication with custom backend?
I'm using a backend service written in Golang for authentication. When a user login, it sends authentication tokens. Now I want to use better-auth only as a frontend authentication system without needing to connect to a database. It should just send login requests to my backend service, then store the received information in a session and user object.
I've read the documentation, but what I understood is that it's a complete authentication library that doesn't allow adding custom logic - it needs to create and handle the database itself. How exactly should I implement my own logic?
âââ
What I want to achieve:
Frontend: better-auth (React/Next.js)
Backend: Existing Golang service (handles actual authentication)
better-auth should:
Send login requests to my Golang backend
Store received tokens in session
Not use its own database
Questions:
How can I disable better-auth's default database usage?
How to configure custom API endpoints for authentication?
How to handle token storage and session management with external backend?
Is there a way to use better-auth as a client-only auth wrapper?
I've read the documentation, but what I understood is that it's a complete authentication library that doesn't allow adding custom logic - it needs to create and handle the database itself. How exactly should I implement my own logic?
âââ
What I want to achieve:
Frontend: better-auth (React/Next.js)
Backend: Existing Golang service (handles actual authentication)
better-auth should:
Send login requests to my Golang backend
Store received tokens in session
Not use its own database
Questions:
How can I disable better-auth's default database usage?
How to configure custom API endpoints for authentication?
How to handle token storage and session management with external backend?
Is there a way to use better-auth as a client-only auth wrapper?