NextAuth.js is an open-source authentication library for Next.js, the React web framework. Authentication means checking who a user is before the user is let in. The project's newer, framework-independent version is called Auth.js. Both are now owned and maintained by Better Auth Inc., which recommends that new projects start with its Better Auth library.
A developer installs the next-auth package and lists sign-in providers in one server file. It supports OAuth 1.0, 1.0A and 2.0 and OpenID Connect, protocols that let a user sign in with an account at another service such as Google, Apple or Facebook. It also supports passwordless sign-in by email and any username-and-password store. Sessions are kept in a database (MySQL, Postgres, MongoDB, SQLite and others) or in JSON Web Tokens, signed tokens stored in a cookie, which it encrypts by default. Sign-in and sign-out requests are protected with CSRF tokens, and the library runs on serverless platforms.
NextAuth.js is free; its repository is under the ISC license.