Introduction

A powerful authentication plugin for PayloadCMS that enhances and extends the default auth system with modern security features.

payload-better-auth-banner

Better Auth for PayloadCMS 🔐

You are one plugin away from revolutionizing your PayloadCMS's authentication system. This plugin seamlessly integrates Better Auth with Payload CMS v3, providing enhanced authentication capabilities.

Quick Start 🚀

Understand what Better Auth is and how it can help your project.

What is @b3nab/payload-better-auth?

Add Better Auth to your PayloadCMS project.

Installation Guide

Set up authentication strategies and other settings.

Configuration Guide

Key Features 🎯

  • Unified Better Auth strategy: email + password, TOTP 2FA, social/OAuth, passkeys
  • Default email verification and password reset flows (overridable)
  • Session management handled by Better Auth
  • Role-based access control via the Better Auth admin plugin
Two-factor authentication
  • Auto-injected social login buttons in the Payload admin login screen
  • 2FA setup prompt before the dashboard, plus setup/verify views
  • Account-level controls (TwoFactorAccountButton)
Social login
  • Collections auto-generated from your Better Auth options
  • Payload endpoints bridged to Better Auth (/login, /logout, /me, ...)
  • Per-collection overrides via extendsCollections
  • Auth layer helpers for Next.js (checkers, guards, server actions)
API Reference

Next.js Integration 🛠️

Better Auth provides a powerful integration with Next.js through the Auth Layer:

Community and Support 🤝

Credits

Created by Benedetto Abbenanti

On this page