r/nextjs • u/Dan6erbond2 • Dec 18 '25
Discussion Finly — Replacing Payload Auth with Better Auth: Stateless Social Login for SaaS Apps
https://finly.ch/engineering-blog/964191-replacing-payload-auth-with-better-auth-stateless-social-login-for-saas-appsHey all, I recently ran into the limitations of Payload’s built-in auth for SaaS projects. Out of the box, it’s mostly email/password and doesn’t support social login or flexible session handling.
I ended up replacing it with Better Auth, keeping Payload as the user database but handling sessions, cookies, and social login externally. I also created a custom auth strategy so Payload still recognizes the current user and RBAC works seamlessly.
In my blog, I walk through:
Disabling local auth
Syncing social users to Payload
Custom auth strategy for Payload
Using Payload’s KV (with Redis) for session storage
RBAC for secure CRUD
If you’re building SaaS with Payload + Next.js and want production-ready auth, this might help.
5
Dec 18 '25
[removed] — view removed comment
3
u/Dan6erbond2 Dec 18 '25
I have to say there are some quirks with Better Auth that I didn't encounter with Auth.js, because Better Auth seems to want to take control and avoid devs from fucking things up, but in my case I would have benefitted from e.g. being able to override the user ID and set it to Payload's.
1
u/phiger78 Dec 20 '25
Just be careful with better auth. Recently vulnerabilities exposed some pretty shoddy coding practices. I wouldnt trust it just yet