Next-auth is an authentication and identity management library for web frameworks. It provides a unified system for handling user sign-in and session state across server and client environments, functioning as a session management framework and an OIDC authentication library.
The project distinguishes itself through a provider-based identity abstraction that supports multiple authentication methods, including OAuth, email magic links, traditional credentials, and passwordless passkeys. It allows for the registration of custom OAuth or OIDC compliant providers and offers tools to define brandable sign-in pages and custom authentication routes.
The library covers a broad surface of identity capabilities, including database persistence via pluggable adapters for user profiles and session storage. It implements request security enforcement through CSRF token validation and route protection via middleware, while maintaining user state using either signed tokens or database-backed sessions.
The system includes observability tools for recording authentication events and errors through logging services.