跳至内容
从 NextAuth.js v4 迁移?阅读 我们的迁移指南.
API 参考@auth/upstash-redis-adapter

@auth/upstash-redis-adapter

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

安装

npm install @upstash/redis @auth/upstash-redis-adapter

UpstashRedisAdapterOptions

这是 Upstash Redis 适配器选项的接口。

属性

accountByUserIdPrefix?

optional accountByUserIdPrefix: string;

accountByUserId 键的前缀

accountKeyPrefix?

optional accountKeyPrefix: string;

account 键的前缀

baseKeyPrefix?

optional baseKeyPrefix: string;

您键的基础前缀

emailKeyPrefix?

optional emailKeyPrefix: string;

emailKey 键的前缀

sessionByUserIdKeyPrefix?

optional sessionByUserIdKeyPrefix: string;

sessionByUserId 键的前缀

sessionKeyPrefix?

optional sessionKeyPrefix: string;

sessionKey 键的前缀

userKeyPrefix?

optional userKeyPrefix: string;

user 键的前缀

verificationTokenKeyPrefix?

optional verificationTokenKeyPrefix: string;

verificationToken 键的前缀


defaultOptions

const defaultOptions: {
  accountByUserIdPrefix: "user:account:by-user-id:";
  accountKeyPrefix: "user:account:";
  baseKeyPrefix: "";
  emailKeyPrefix: "user:email:";
  sessionByUserIdKeyPrefix: "user:session:by-user-id:";
  sessionKeyPrefix: "user:session:";
  userKeyPrefix: "user:";
  verificationTokenKeyPrefix: "user:token:";
};

类型声明

accountByUserIdPrefix

accountByUserIdPrefix: string = "user:account:by-user-id:";

accountKeyPrefix

accountKeyPrefix: string = "user:account:";

baseKeyPrefix

baseKeyPrefix: string = "";

emailKeyPrefix

emailKeyPrefix: string = "user:email:";

sessionByUserIdKeyPrefix

sessionByUserIdKeyPrefix: string = "user:session:by-user-id:";

sessionKeyPrefix

sessionKeyPrefix: string = "user:session:";

userKeyPrefix

userKeyPrefix: string = "user:";

verificationTokenKeyPrefix

verificationTokenKeyPrefix: string = "user:token:";

UpstashRedisAdapter()

UpstashRedisAdapter(client, options): Adapter

参数

参数类型
客户端Redis
optionsUpstashRedisAdapterOptions

返回值

适配器


hydrateDates()

hydrateDates(json): any

参数

参数类型
jsonobject

返回值

any

Auth.js © Balázs Orbán 和团队 -2024