Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference@auth/upstash-redis-adapter

@auth/upstash-redis-adapter

Official Upstash Redis adapter for Auth.js / NextAuth.js.

Installation

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

UpstashRedisAdapterOptions

This is the interface of the Upstash Redis adapter options.

Properties

accountByUserIdPrefix?

optional accountByUserIdPrefix: string;

The prefix for the accountByUserId key

accountKeyPrefix?

optional accountKeyPrefix: string;

The prefix for the account key

baseKeyPrefix?

optional baseKeyPrefix: string;

The base prefix for your keys

emailKeyPrefix?

optional emailKeyPrefix: string;

The prefix for the emailKey key

sessionByUserIdKeyPrefix?

optional sessionByUserIdKeyPrefix: string;

The prefix for the sessionByUserId key

sessionKeyPrefix?

optional sessionKeyPrefix: string;

The prefix for the sessionKey key

userKeyPrefix?

optional userKeyPrefix: string;

The prefix for the user key

verificationTokenKeyPrefix?

optional verificationTokenKeyPrefix: string;

The prefix for the verificationToken key


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:";
};

Type declaration

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

Parameters

ParameterType
clientRedis
optionsUpstashRedisAdapterOptions

Returns

Adapter


hydrateDates()

hydrateDates(json): any

Parameters

ParameterType
jsonobject

Returns

any

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