Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
lib
Entities

lib/entities

Account

Implements

Constructors

new Account(undefined)

new Account(): Account
Returns

Account

Properties

access_token?

optional access_token: string;
Implementation of

RemoveIndex.access_token

expires_at?

optional expires_at: number;
Implementation of

RemoveIndex.expires_at

id

id: string;

id_token?

optional id_token: string;
Implementation of

RemoveIndex.id_token

provider

provider: string;
Implementation of

RemoveIndex.provider

providerAccountId

providerAccountId: string;
Implementation of

RemoveIndex.providerAccountId

refresh_token?

optional refresh_token: string;
Implementation of

RemoveIndex.refresh_token

scope?

optional scope: string;
Implementation of

RemoveIndex.scope

session_state?

optional session_state: JsonValue;

token_type?

optional token_type: "bearer" | "dpop" | Lowercase<string>;
Implementation of

RemoveIndex.token_type

type

type: "email" | "oidc" | "oauth" | "webauthn";
Implementation of

RemoveIndex.type

user

user: User;

userId

userId: string;
Implementation of

RemoveIndex.userId


Session

A session holds information about a user’s current signin state.

Implements

Constructors

new Session(undefined)

new Session(): Session
Returns

Session

Properties

expires

expires: Date;

The absolute date when the session expires.

If a session is accessed prior to its expiry date, it will be extended based on the maxAge option as defined in by SessionOptions.maxAge. It is never extended more than once in a period defined by SessionOptions.updateAge.

If a session is accessed past its expiry date, it will be removed from the database to clean up inactive sessions.

Implementation of

AdapterSession.expires

id

id: string;

sessionToken

sessionToken: string;

A randomly generated value that is used to look up the session in the database when using "database" AuthConfig.strategy option. This value is saved in a secure, HTTP-Only cookie on the client.

Implementation of

AdapterSession.sessionToken

user

user: User;

userId

userId: string;

Connects the active session to a user in the database

Implementation of

AdapterSession.userId


User

Implements

Constructors

new User(undefined)

new User(): User
Returns

User

Properties

accounts

accounts: Collection<Account, object>;

email

email: string = "";
Implementation of

RemoveIndex.email

emailVerified

emailVerified: null | Date = null;
Implementation of

RemoveIndex.emailVerified

id

id: string;
Implementation of

RemoveIndex.id

image?

optional image: null | string;
Implementation of

RemoveIndex.image

name?

optional name: null | string;
Implementation of

RemoveIndex.name

sessions

sessions: Collection<Session, object>;

VerificationToken

A verification token is a temporary token that is used to sign in a user via their email address. It is created when a user signs in with an Email provider. When the user clicks the link in the email, the token and email is sent back to the server where it is hashed and compared to the value in the database. If the tokens and emails match, and the token hasn’t expired yet, the user is signed in. The token is then deleted from the database.

Implements

Constructors

new VerificationToken(undefined)

new VerificationToken(): VerificationToken
Returns

VerificationToken

Properties

expires

expires: Date;

The absolute date when the token expires.

Implementation of

VerificationToken.expires

identifier

identifier: string;

The user’s email address.

Implementation of

VerificationToken.identifier

token

token: string;

A hashed token, using the AuthConfig.secret value.

Implementation of

VerificationToken.token

Auth.js © Balázs Orbán and Team - 2024