Create a database user
Persisting a newly authenticated person in an adapter-backed database.
Auth.js · Interface
AdapterUser is the database-facing user shape used by an Auth.js adapter. It represents someone who can sign in and carries the identity data needed to associate that person with accounts and authentication records.
AdapterUser is the database-backed user shape used by Auth.js adapters. It identifies someone who can sign in and includes the required identifier, email, and email-verification state, with optional profile fields such as name and image.
interface AdapterUser extends User {
id: string
email: string
emailVerified: Date | null
}An AdapterUser value representing a sign-in-capable user.
import type { AdapterUser } from "next-auth/adapters"
const user: AdapterUser = {
id: "user_123",
email: "ada@example.com",
emailVerified: null,
name: "Ada Lovelace",
image: null,
}
console.log(user.id)Creates a value that satisfies the adapter user shape.
Persisting a newly authenticated person in an adapter-backed database.
Returning a normalized user from an adapter lookup.
Associating an OAuth provider account with its application user.
AdapterUser is the user representation returned by an Auth.js adapter and represents a person who can sign in. Adapter operations such as creating or updating a database user return this shape.
Follow-up: How does it differ from User? User is the provider/profile-facing shape, while AdapterUser is the adapter/database-facing shape and includes the adapter-required identity fields.
Its required identity data includes a unique user identifier, an email address, and the email verification value. Optional profile information can include a display name and image.
Follow-up: Why is the identifier essential? Adapter operations use it to retrieve, update, delete, and associate related records with the user.
When a user is absent, Auth.js can create the user on the first sign-in using identity-provider profile data. It also creates and links the corresponding provider account.
Follow-up: What should an adapter support beyond users? It should also link and unlink accounts and handle active sessions and passwordless authentication.
AdapterUserAccountcreateUserupdateUsergetUser