Auth.js Database Schema Explained: Four Core Tables and How They Work
Auth.js, formerly known as NextAuth, automatically creates four database tables when integrated into a project: users, accounts, sessions, and verification_tokens. The users and accounts tables share a one-to-one relationship, while a single user can be linked to multiple OAuth providers such as Google or GitHub. Sessions are generated on every sign-in and tied to individual users, supporting multiple simultaneous sessions across different devices. Verification tokens are short-lived, used for tasks like email verification, and are deleted automatically once expired. Developers can safely extend the users table with custom columns, as Auth.js ignores fields it does not recognize.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in