コンテンツへスキップ
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;
};

型パラメータ

型パラメータ
T文字列

型宣言

access_token?

optional access_token: string;

expires_at?

optional expires_at: number;

id

id: string;

プロバイダー

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;

型パラメータ

型パラメータ
T文字列

UserDoc

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

型宣言

email

email: string;

SurrealDBAdapter()

SurrealDBAdapter<T>(client): Adapter

型パラメータ

型パラメータ
T

パラメータ

パラメータ
クライアントPromise<WebSocketStrategy | HTTPStrategy<T>>

戻り値

アダプター


toId()

toId(surrealId): string

パラメータ

パラメータ
surrealId文字列

戻り値

文字列


toSurrealId()

toSurrealId(id): string

パラメータ

パラメータ
id文字列

戻り値

文字列

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