跳至內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.
API 參考@auth/surrealdb-adapter

@auth/surrealdb-adapter

Auth.js / NextAuth.js 的官方 SurrealDB 适配器。

安裝

npm install @auth/surrealdb-adapter surrealdb.js

AccountDoc<T>

type AccountDoc<T>: {
  access_token: string;
  expires_at: number;
  id: string;
  provider: string;
  providerAccountId: string;
  refresh_token: string;
  type: Extract<ProviderType, "oauth" | "oidc" | "email" | "webauthn">;
  userId: T;
};

類型參數

類型參數
Tstring

類型宣告

access_token?

optional access_token: string;

expires_at?

optional expires_at: number;

id

id: string;

provider

provider: string;

providerAccountId

providerAccountId: string;

refresh_token?

optional refresh_token: string;

type

type: Extract<ProviderType, "oauth" | "oidc" | "email" | "webauthn">;

userId

userId: T;

SessionDoc<T>

type SessionDoc<T>: Document & {
  userId: T;
};

類型宣告

userId

userId: T;

類型參數

類型參數
Tstring

UserDoc

type UserDoc: Document & {
  email: string;
};

類型宣告

email

email: string;

SurrealDBAdapter()

SurrealDBAdapter<T>(client): Adapter

類型參數

類型參數
T

參數

參數類型
clientPromise<WebSocketStrategy | HTTPStrategy<T>>

回傳值

适配器


toId()

toId(surrealId): string

參數

參數類型
surrealIdstring

回傳值

string


toSurrealId()

toSurrealId(id): string

參數

參數類型
idstring

回傳值

string

Auth.js © Balázs Orbán 和團隊 -2024