跳至內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.

lib/entities

帳戶

實作

建構子

new Account(undefined)

new Account(): Account
返回

帳戶

屬性

access_token?

optional access_token: string;
實作於

RemoveIndex.access_token

expires_at?

optional expires_at: number;
實作於

RemoveIndex.expires_at

id

id: string;

id_token?

optional id_token: string;
實作於

RemoveIndex.id_token

provider

provider: string;
實作於

RemoveIndex.provider

providerAccountId

providerAccountId: string;
實作於

RemoveIndex.providerAccountId

refresh_token?

optional refresh_token: string;
實作於

RemoveIndex.refresh_token

scope?

optional scope: string;
實作於

RemoveIndex.scope

session_state?

optional session_state: JsonValue;

token_type?

optional token_type: Lowercase<string>;
實作於

RemoveIndex.token_type

type

type: AdapterAccountType;
實作於

RemoveIndex.type

user

user: User;

userId

userId: string;
實作於

RemoveIndex.userId


會話

會話保留有關使用者目前登入狀態的資訊。

實作

建構子

new Session(undefined)

new Session(): Session
返回

會話

屬性

expires

expires: Date;

會話過期的絕對日期。

如果在過期日期之前存取會話,則會根據 SessionOptions.maxAge 中定義的 maxAge 選項延長會話。在 SessionOptions.updateAge 定義的期間內,永遠不會延長超過一次。

如果在過期日期之後存取會話,則會將其從資料庫中移除,以清除非作用中的會話。

實作於

AdapterSession.expires

id

id: string;

sessionToken

sessionToken: string;

使用 "database" AuthConfig.strategy 選項時,用於在資料庫中查找會話的隨機產生值。此值會儲存在用戶端上安全、僅限 HTTP 的 Cookie 中。

實作於

AdapterSession.sessionToken

user

user: User;

userId

userId: string;

將活動中的會話連接到資料庫中的使用者

實作於

AdapterSession.userId


使用者

實作

建構函式

new User(undefined)

new User(): User
回傳值

使用者

屬性

accounts

accounts: Collection<Account, object>;

email

email: string = "";
實作自

RemoveIndex.email

emailVerified

emailVerified: null | Date = null;
實作自

RemoveIndex.emailVerified

id

id: string;
實作自

RemoveIndex.id

image?

optional image: null | string;
實作自

RemoveIndex.image

name?

optional name: null | string;
實作自

RemoveIndex.name

sessions

sessions: Collection<Session, object>;

VerificationToken

驗證權杖是一個臨時權杖,用於通過電子郵件地址登入使用者。當使用者使用電子郵件供應商登入時建立。當使用者點擊電子郵件中的連結時,權杖和電子郵件會被發回伺服器,伺服器會對其進行雜湊並與資料庫中的值進行比較。如果權杖和電子郵件匹配,且權杖尚未過期,則使用者會被登入。然後,權杖會從資料庫中刪除。

實作

建構函式

new VerificationToken(undefined)

new VerificationToken(): VerificationToken
回傳值

驗證令牌

屬性

expires

expires: Date;

權杖過期的絕對日期。

實作自

VerificationToken.expires

identifier

identifier: string;

使用者的電子郵件地址。

實作自

VerificationToken.identifier

token

token: string;

使用AuthConfig.secret值進行雜湊的權杖。

實作自

VerificationToken.token

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