@nest-boot/auth
Classes
AuthGuard
Defined in: packages/auth/src/auth.guard.ts:8
Implements
CanActivate
Constructors
Constructor
new AuthGuard(reflector): AuthGuard;
Defined in: packages/auth/src/auth.guard.ts:9
Parameters
| Parameter | Type |
|---|---|
reflector | Reflector |
Returns
Properties
reflector
protected readonly reflector: Reflector;
Defined in: packages/auth/src/auth.guard.ts:9
Methods
canActivate()
canActivate(context): Promise<boolean>;
Defined in: packages/auth/src/auth.guard.ts:19
Parameters
| Parameter | Type | Description |
|---|---|---|
context | ExecutionContext | Current execution context. Provides access to details about the current request pipeline. |
Returns
Promise<boolean>
Value indicating whether or not the current request is allowed to proceed.
Implementation of
CanActivate.canActivate
getResponse()
getResponse(context): Promise<Response<any, Record<string, any>>>;
Defined in: packages/auth/src/auth.guard.ts:11
Parameters
| Parameter | Type |
|---|---|
context | ExecutionContext |
Returns
Promise<Response<any, Record<string, any>>>
AuthMiddleware
Defined in: packages/auth/src/auth.middleware.ts:12
Implements
NestMiddleware
Constructors
Constructor
new AuthMiddleware(
options,
authService,
em): AuthMiddleware;
Defined in: packages/auth/src/auth.middleware.ts:13
Parameters
| Parameter | Type |
|---|---|
options | AuthModuleOptions |
authService | AuthService |
em | EntityManager |
Returns
Methods
use()
use(
req,
res,
next): Promise<void>;
Defined in: packages/auth/src/auth.middleware.ts:36
Parameters
| Parameter | Type |
|---|---|
req | Request |
res | Response |
next | NextFunction |
Returns
Promise<void>
Implementation of
NestMiddleware.use
AuthModule
Defined in: packages/auth/src/auth.module.ts:44
Extends
ConfigurableModuleClass
Indexable
[key: string]: any
Constructors
Constructor
new AuthModule(
auth,
options,
middlewareManager,
authMiddleware): AuthModule;
Defined in: packages/auth/src/auth.module.ts:45
Parameters
| Parameter | Type |
|---|---|
auth | Auth |
options | AuthModuleOptions |
middlewareManager | MiddlewareManager |
authMiddleware | AuthMiddleware |
Returns
Overrides
ConfigurableModuleClass.constructor
Properties
forRoot()
static forRoot: (options) => DynamicModule;
Parameters
| Parameter | Type |
|---|---|
options | AuthModuleOptions & Partial<{ }> |
Returns
DynamicModule
Inherited from
ConfigurableModuleClass.forRoot
forRootAsync()
static forRootAsync: (options) => DynamicModule;
Parameters
| Parameter | Type |
|---|---|
options | ConfigurableModuleAsyncOptions<AuthModuleOptions, "create"> & Partial<{ }> |
Returns
DynamicModule
Inherited from
ConfigurableModuleClass.forRootAsync
AuthService
Defined in: packages/auth/src/auth.service.ts:6
Constructors
Constructor
new AuthService(auth): AuthService;
Defined in: packages/auth/src/auth.service.ts:7
Parameters
| Parameter | Type |
|---|---|
auth | Auth |
Returns
Accessors
api
Get Signature
get api(): InferAPI<{
accountInfo: StrictEndpoint<"/account-info", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
additionalProperties: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
query: ZodOptional<ZodObject<{
accountId: ZodOptional<ZodString>;
}, $strip>>;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
},
| {
data: Record<string, any>;
user: OAuth2UserInfo;
}
| null>;
callbackOAuth: StrictEndpoint<"/callback/:id", {
body: ZodOptional<ZodObject<{
code: ZodOptional<ZodString>;
device_id: ZodOptional<ZodString>;
error: ZodOptional<ZodString>;
error_description: ZodOptional<ZodString>;
state: ZodOptional<ZodString>;
user: ZodOptional<ZodString>;
}, $strip>>;
metadata: {
allowedMediaTypes: string[];
scope: "server";
};
method: ("GET" | "POST")[];
operationId: string;
query: ZodOptional<ZodObject<{
code: ZodOptional<ZodString>;
device_id: ZodOptional<ZodString>;
error: ZodOptional<ZodString>;
error_description: ZodOptional<ZodString>;
state: ZodOptional<ZodString>;
user: ZodOptional<ZodString>;
}, $strip>>;
}, void>;
changeEmail: StrictEndpoint<"/change-email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
newEmail: ZodEmail;
}, $strip>;
metadata: {
openapi: {
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
422: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
changePassword: StrictEndpoint<"/change-password", {
body: ZodObject<{
currentPassword: ZodString;
newPassword: ZodString;
revokeOtherSessions: ZodOptional<ZodBoolean>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
token: string | null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image: string | null | undefined;
name: string;
updatedAt: Date;
};
}>;
deleteUser: StrictEndpoint<"/delete-user", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
password: ZodOptional<ZodString>;
token: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
password: ...;
token: ...;
};
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
message: string;
success: boolean;
}>;
deleteUserCallback: StrictEndpoint<"/delete-user/callback", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
query: ZodObject<{
callbackURL: ZodOptional<ZodString>;
token: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
}, {
message: string;
success: boolean;
}>;
error: StrictEndpoint<"/error", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
text/html: {
schema: {
description: ...;
type: ...;
};
};
};
description: string;
};
};
};
scope: "server";
};
method: "GET";
}, Response>;
getAccessToken: StrictEndpoint<"/get-access-token", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
userId: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
description: string;
};
};
};
};
method: "POST";
}, {
accessToken: string;
accessTokenExpiresAt: Date | undefined;
idToken: string | undefined;
scopes: string[];
}>;
getSession: StrictEndpoint<"/get-session", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
nullable: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodOptional<ZodObject<{
disableCookieCache: ZodOptional<ZodCoercedBoolean<unknown>>;
disableRefresh: ZodOptional<ZodCoercedBoolean<unknown>>;
}, $strip>>;
requireHeaders: true;
},
| {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null>;
linkSocialAccount: StrictEndpoint<"/link-social", {
body: ZodObject<{
additionalData: ZodOptional<ZodRecord<ZodString, ZodAny>>;
callbackURL: ZodOptional<ZodString>;
disableRedirect: ZodOptional<ZodBoolean>;
errorCallbackURL: ZodOptional<ZodString>;
idToken: ZodOptional<ZodObject<{
accessToken: ZodOptional<ZodString>;
nonce: ZodOptional<ZodString>;
refreshToken: ZodOptional<ZodString>;
scopes: ZodOptional<ZodArray<...>>;
token: ZodString;
}, $strip>>;
provider: ZodType<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown, $ZodTypeInternals<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown>>;
requestSignUp: ZodOptional<ZodBoolean>;
scopes: ZodOptional<ZodArray<ZodString>>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
redirect: boolean;
url: string;
}>;
listSessions: StrictEndpoint<"/list-sessions", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
items: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, Prettify<{
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
}>[]>;
listUserAccounts: StrictEndpoint<"/list-accounts", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
items: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
accountId: string;
createdAt: Date;
id: string;
providerId: string;
scopes: string[];
updatedAt: Date;
userId: string;
}[]>;
ok: StrictEndpoint<"/ok", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
scope: "server";
};
method: "GET";
}, {
ok: boolean;
}>;
refreshToken: StrictEndpoint<"/refresh-token", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
userId: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
description: string;
};
};
};
};
method: "POST";
}, {
accessToken: string | undefined;
accessTokenExpiresAt: Date | undefined;
accountId: string;
idToken: string | null | undefined;
providerId: string;
refreshToken: string | undefined;
refreshTokenExpiresAt: Date | undefined;
scope: string | null | undefined;
}>;
requestPasswordReset: StrictEndpoint<"/request-password-reset", {
body: ZodObject<{
email: ZodEmail;
redirectTo: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
}, {
message: string;
status: boolean;
}>;
requestPasswordResetCallback: StrictEndpoint<"/reset-password/:token", {
metadata: {
openapi: {
description: string;
operationId: string;
parameters: (
| {
description: string;
in: "path";
name: string;
required: true;
schema: {
type: "string";
};
}
| {
description: string;
in: "query";
name: string;
required: true;
schema: {
type: "string";
};
})[];
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodObject<{
callbackURL: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
}, never>;
resetPassword: StrictEndpoint<"/reset-password", {
body: ZodObject<{
newPassword: ZodString;
token: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
query: ZodOptional<ZodObject<{
token: ZodOptional<ZodString>;
}, $strip>>;
}, {
status: boolean;
}>;
revokeOtherSessions: StrictEndpoint<"/revoke-other-sessions", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
revokeSession: StrictEndpoint<"/revoke-session", {
body: ZodObject<{
token: ZodString;
}, $strip>;
metadata: {
openapi: {
description: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
token: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
revokeSessions: StrictEndpoint<"/revoke-sessions", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
sendVerificationEmail: StrictEndpoint<"/send-verification-email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodEmail;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
email: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
}, {
status: boolean;
}>;
setPassword: StrictEndpoint<string, {
body: ZodObject<{
newPassword: ZodString;
}, $strip>;
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
signInEmail: StrictEndpoint<"/sign-in/email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodString;
password: ZodString;
rememberMe: ZodOptional<ZodDefault<ZodBoolean>>;
}, $strip>;
metadata: {
$Infer: {
body: {
callbackURL?: string;
email: string;
password: string;
rememberMe?: boolean;
};
returned: {
redirect: boolean;
token: string;
url?: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
description: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
}, {
redirect: boolean;
token: string;
url?: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
signInSocial: StrictEndpoint<"/sign-in/social", {
body: ZodObject<{
additionalData: ZodOptional<ZodRecord<ZodString, ZodAny>>;
callbackURL: ZodOptional<ZodString>;
disableRedirect: ZodOptional<ZodBoolean>;
errorCallbackURL: ZodOptional<ZodString>;
idToken: ZodOptional<ZodObject<{
accessToken: ZodOptional<ZodString>;
expiresAt: ZodOptional<ZodNumber>;
nonce: ZodOptional<ZodString>;
refreshToken: ZodOptional<ZodString>;
token: ZodString;
}, $strip>>;
loginHint: ZodOptional<ZodString>;
newUserCallbackURL: ZodOptional<ZodString>;
provider: ZodType<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown, $ZodTypeInternals<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown>>;
requestSignUp: ZodOptional<ZodBoolean>;
scopes: ZodOptional<ZodArray<ZodString>>;
}, $strip>;
metadata: {
$Infer: {
body: {
additionalData?: Record<string, any>;
callbackURL?: string;
disableRedirect?: boolean;
errorCallbackURL?: string;
idToken?: {
accessToken?: string;
expiresAt?: number;
nonce?: string;
refreshToken?: string;
token: string;
};
loginHint?: string;
newUserCallbackURL?: string;
provider: | "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
};
requestSignUp?: boolean;
scopes?: string[];
};
returned: {
redirect: boolean;
token?: string;
url?: string;
user?: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
description: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
},
| {
redirect: boolean;
url: string;
}
| {
redirect: boolean;
token: string;
url: undefined;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
signOut: StrictEndpoint<"/sign-out", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
requireHeaders: true;
}, {
success: boolean;
}>;
signUpEmail: StrictEndpoint<"/sign-up/email", {
body: ZodIntersection<ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodEmail;
image: ZodOptional<ZodString>;
name: ZodString;
password: ZodString;
rememberMe: ZodOptional<ZodBoolean>;
}, $strip>, ZodRecord<ZodString, ZodAny>>;
metadata: {
$Infer: {
body: {
callbackURL?: string;
email: string;
image?: string;
name: string;
password: string;
rememberMe?: boolean;
};
returned: {
token: string | null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
email: ...;
image: ...;
name: ...;
password: ...;
rememberMe: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
422: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
},
| {
token: null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| {
token: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
unlinkAccount: StrictEndpoint<"/unlink-account", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
updateUser: StrictEndpoint<"/update-user", {
body: ZodRecord<ZodString, ZodAny>;
metadata: {
$Infer: {
body: Partial<{
}> & {
image?: string | null;
name?: string;
};
};
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
image: ...;
name: ...;
};
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
verifyEmail: StrictEndpoint<"/verify-email", {
metadata: {
openapi: {
description: string;
parameters: (
| {
description: string;
in: "query";
name: string;
required: true;
schema: {
type: "string";
};
}
| {
description: string;
in: "query";
name: string;
required: false;
schema: {
type: "string";
};
})[];
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodObject<{
callbackURL: ZodOptional<ZodString>;
token: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
},
| void
| {
status: boolean;
}>;
}>;
Defined in: packages/auth/src/auth.service.ts:12
Returns
InferAPI<{
accountInfo: StrictEndpoint<"/account-info", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
additionalProperties: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
query: ZodOptional<ZodObject<{
accountId: ZodOptional<ZodString>;
}, $strip>>;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
},
| {
data: Record<string, any>;
user: OAuth2UserInfo;
}
| null>;
callbackOAuth: StrictEndpoint<"/callback/:id", {
body: ZodOptional<ZodObject<{
code: ZodOptional<ZodString>;
device_id: ZodOptional<ZodString>;
error: ZodOptional<ZodString>;
error_description: ZodOptional<ZodString>;
state: ZodOptional<ZodString>;
user: ZodOptional<ZodString>;
}, $strip>>;
metadata: {
allowedMediaTypes: string[];
scope: "server";
};
method: ("GET" | "POST")[];
operationId: string;
query: ZodOptional<ZodObject<{
code: ZodOptional<ZodString>;
device_id: ZodOptional<ZodString>;
error: ZodOptional<ZodString>;
error_description: ZodOptional<ZodString>;
state: ZodOptional<ZodString>;
user: ZodOptional<ZodString>;
}, $strip>>;
}, void>;
changeEmail: StrictEndpoint<"/change-email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
newEmail: ZodEmail;
}, $strip>;
metadata: {
openapi: {
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
422: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
changePassword: StrictEndpoint<"/change-password", {
body: ZodObject<{
currentPassword: ZodString;
newPassword: ZodString;
revokeOtherSessions: ZodOptional<ZodBoolean>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
token: string | null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image: string | null | undefined;
name: string;
updatedAt: Date;
};
}>;
deleteUser: StrictEndpoint<"/delete-user", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
password: ZodOptional<ZodString>;
token: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
password: ...;
token: ...;
};
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
message: string;
success: boolean;
}>;
deleteUserCallback: StrictEndpoint<"/delete-user/callback", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
query: ZodObject<{
callbackURL: ZodOptional<ZodString>;
token: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
}, {
message: string;
success: boolean;
}>;
error: StrictEndpoint<"/error", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
text/html: {
schema: {
description: ...;
type: ...;
};
};
};
description: string;
};
};
};
scope: "server";
};
method: "GET";
}, Response>;
getAccessToken: StrictEndpoint<"/get-access-token", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
userId: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
description: string;
};
};
};
};
method: "POST";
}, {
accessToken: string;
accessTokenExpiresAt: Date | undefined;
idToken: string | undefined;
scopes: string[];
}>;
getSession: StrictEndpoint<"/get-session", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
nullable: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodOptional<ZodObject<{
disableCookieCache: ZodOptional<ZodCoercedBoolean<unknown>>;
disableRefresh: ZodOptional<ZodCoercedBoolean<unknown>>;
}, $strip>>;
requireHeaders: true;
},
| {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null>;
linkSocialAccount: StrictEndpoint<"/link-social", {
body: ZodObject<{
additionalData: ZodOptional<ZodRecord<ZodString, ZodAny>>;
callbackURL: ZodOptional<ZodString>;
disableRedirect: ZodOptional<ZodBoolean>;
errorCallbackURL: ZodOptional<ZodString>;
idToken: ZodOptional<ZodObject<{
accessToken: ZodOptional<ZodString>;
nonce: ZodOptional<ZodString>;
refreshToken: ZodOptional<ZodString>;
scopes: ZodOptional<ZodArray<...>>;
token: ZodString;
}, $strip>>;
provider: ZodType<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown, $ZodTypeInternals<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown>>;
requestSignUp: ZodOptional<ZodBoolean>;
scopes: ZodOptional<ZodArray<ZodString>>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
redirect: boolean;
url: string;
}>;
listSessions: StrictEndpoint<"/list-sessions", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
items: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, Prettify<{
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
}>[]>;
listUserAccounts: StrictEndpoint<"/list-accounts", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
items: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
accountId: string;
createdAt: Date;
id: string;
providerId: string;
scopes: string[];
updatedAt: Date;
userId: string;
}[]>;
ok: StrictEndpoint<"/ok", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
scope: "server";
};
method: "GET";
}, {
ok: boolean;
}>;
refreshToken: StrictEndpoint<"/refresh-token", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
userId: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
description: string;
};
};
};
};
method: "POST";
}, {
accessToken: string | undefined;
accessTokenExpiresAt: Date | undefined;
accountId: string;
idToken: string | null | undefined;
providerId: string;
refreshToken: string | undefined;
refreshTokenExpiresAt: Date | undefined;
scope: string | null | undefined;
}>;
requestPasswordReset: StrictEndpoint<"/request-password-reset", {
body: ZodObject<{
email: ZodEmail;
redirectTo: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
}, {
message: string;
status: boolean;
}>;
requestPasswordResetCallback: StrictEndpoint<"/reset-password/:token", {
metadata: {
openapi: {
description: string;
operationId: string;
parameters: (
| {
description: string;
in: "path";
name: string;
required: true;
schema: {
type: "string";
};
}
| {
description: string;
in: "query";
name: string;
required: true;
schema: {
type: "string";
};
})[];
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodObject<{
callbackURL: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
}, never>;
resetPassword: StrictEndpoint<"/reset-password", {
body: ZodObject<{
newPassword: ZodString;
token: ZodOptional<ZodString>;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
query: ZodOptional<ZodObject<{
token: ZodOptional<ZodString>;
}, $strip>>;
}, {
status: boolean;
}>;
revokeOtherSessions: StrictEndpoint<"/revoke-other-sessions", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
revokeSession: StrictEndpoint<"/revoke-session", {
body: ZodObject<{
token: ZodString;
}, $strip>;
metadata: {
openapi: {
description: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
token: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
revokeSessions: StrictEndpoint<"/revoke-sessions", {
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
requireHeaders: true;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
sendVerificationEmail: StrictEndpoint<"/send-verification-email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodEmail;
}, $strip>;
metadata: {
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
email: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
400: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
}, {
status: boolean;
}>;
setPassword: StrictEndpoint<string, {
body: ZodObject<{
newPassword: ZodString;
}, $strip>;
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
signInEmail: StrictEndpoint<"/sign-in/email", {
body: ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodString;
password: ZodString;
rememberMe: ZodOptional<ZodDefault<ZodBoolean>>;
}, $strip>;
metadata: {
$Infer: {
body: {
callbackURL?: string;
email: string;
password: string;
rememberMe?: boolean;
};
returned: {
redirect: boolean;
token: string;
url?: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
description: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
}, {
redirect: boolean;
token: string;
url?: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
signInSocial: StrictEndpoint<"/sign-in/social", {
body: ZodObject<{
additionalData: ZodOptional<ZodRecord<ZodString, ZodAny>>;
callbackURL: ZodOptional<ZodString>;
disableRedirect: ZodOptional<ZodBoolean>;
errorCallbackURL: ZodOptional<ZodString>;
idToken: ZodOptional<ZodObject<{
accessToken: ZodOptional<ZodString>;
expiresAt: ZodOptional<ZodNumber>;
nonce: ZodOptional<ZodString>;
refreshToken: ZodOptional<ZodString>;
token: ZodString;
}, $strip>>;
loginHint: ZodOptional<ZodString>;
newUserCallbackURL: ZodOptional<ZodString>;
provider: ZodType<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown, $ZodTypeInternals<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
}, unknown>>;
requestSignUp: ZodOptional<ZodBoolean>;
scopes: ZodOptional<ZodArray<ZodString>>;
}, $strip>;
metadata: {
$Infer: {
body: {
additionalData?: Record<string, any>;
callbackURL?: string;
disableRedirect?: boolean;
errorCallbackURL?: string;
idToken?: {
accessToken?: string;
expiresAt?: number;
nonce?: string;
refreshToken?: string;
token: string;
};
loginHint?: string;
newUserCallbackURL?: string;
provider: | "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| string & {
};
requestSignUp?: boolean;
scopes?: string[];
};
returned: {
redirect: boolean;
token?: string;
url?: string;
user?: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
description: ...;
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
},
| {
redirect: boolean;
url: string;
}
| {
redirect: boolean;
token: string;
url: undefined;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
signOut: StrictEndpoint<"/sign-out", {
metadata: {
openapi: {
description: string;
operationId: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
requireHeaders: true;
}, {
success: boolean;
}>;
signUpEmail: StrictEndpoint<"/sign-up/email", {
body: ZodIntersection<ZodObject<{
callbackURL: ZodOptional<ZodString>;
email: ZodEmail;
image: ZodOptional<ZodString>;
name: ZodString;
password: ZodString;
rememberMe: ZodOptional<ZodBoolean>;
}, $strip>, ZodRecord<ZodString, ZodAny>>;
metadata: {
$Infer: {
body: {
callbackURL?: string;
email: string;
image?: string;
name: string;
password: string;
rememberMe?: boolean;
};
returned: {
token: string | null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
};
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
callbackURL: ...;
email: ...;
image: ...;
name: ...;
password: ...;
rememberMe: ...;
};
required: ...[];
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
422: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
},
| {
token: null;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| {
token: string;
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}>;
unlinkAccount: StrictEndpoint<"/unlink-account", {
body: ZodObject<{
accountId: ZodOptional<ZodString>;
providerId: ZodString;
}, $strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
updateUser: StrictEndpoint<"/update-user", {
body: ZodRecord<ZodString, ZodAny>;
metadata: {
$Infer: {
body: Partial<{
}> & {
image?: string | null;
name?: string;
};
};
openapi: {
description: string;
operationId: string;
requestBody: {
content: {
application/json: {
schema: {
properties: {
image: ...;
name: ...;
};
type: "object";
};
};
};
};
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "POST";
operationId: string;
use: (inputContext) => Promise<{
session: {
session: Record<..., ...> & {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: Record<..., ...> & {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
}>[];
}, {
status: boolean;
}>;
verifyEmail: StrictEndpoint<"/verify-email", {
metadata: {
openapi: {
description: string;
parameters: (
| {
description: string;
in: "query";
name: string;
required: true;
schema: {
type: "string";
};
}
| {
description: string;
in: "query";
name: string;
required: false;
schema: {
type: "string";
};
})[];
responses: {
200: {
content: {
application/json: {
schema: {
properties: ...;
required: ...;
type: ...;
};
};
};
description: string;
};
};
};
};
method: "GET";
operationId: string;
query: ZodObject<{
callbackURL: ZodOptional<ZodString>;
token: ZodString;
}, $strip>;
use: (inputContext) => Promise<void>[];
},
| void
| {
status: boolean;
}>;
}>
AuthTransactionContext
Defined in: packages/auth/src/auth.transaction-context.ts:48
Constructors
Constructor
new AuthTransactionContext(): AuthTransactionContext;
Returns
Methods
entries()
entries(): [string, string][];
Defined in: packages/auth/src/auth.transaction-context.ts:61
Returns
[string, string][]
set()
set<S>(key, value): AuthTransactionContext;
Defined in: packages/auth/src/auth.transaction-context.ts:51
Type Parameters
| Type Parameter |
|---|
S extends string |
Parameters
| Parameter | Type |
|---|---|
key | SnakeCase<S> |
value | string |
Returns
toSQL()
toSQL(): string;
Defined in: packages/auth/src/auth.transaction-context.ts:65
Returns
string
abstract BaseAccount
Defined in: packages/auth/src/entities/account.entity.ts:14
Extends
BaseEntity
Constructors
Constructor
new BaseAccount(): BaseAccount;
Returns
Inherited from
BaseEntity.constructor
Properties
accessToken?
optional accessToken: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:32
accessTokenExpiresAt?
optional accessTokenExpiresAt: Opt<Date>;
Defined in: packages/auth/src/entities/account.entity.ts:41
accountId
accountId: string;
Defined in: packages/auth/src/entities/account.entity.ts:19
createdAt
createdAt: Opt<Date>;
Defined in: packages/auth/src/entities/account.entity.ts:53
id
id: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:16
idToken?
optional idToken: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:38
password?
optional password: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:50
providerId
providerId: string;
Defined in: packages/auth/src/entities/account.entity.ts:22
refreshToken?
optional refreshToken: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:35
refreshTokenExpiresAt?
optional refreshTokenExpiresAt: Opt<Date>;
Defined in: packages/auth/src/entities/account.entity.ts:44
scope?
optional scope: Opt<string>;
Defined in: packages/auth/src/entities/account.entity.ts:47
updatedAt
updatedAt: Opt<Date>;
Defined in: packages/auth/src/entities/account.entity.ts:60
userId
userId: string;
Defined in: packages/auth/src/entities/account.entity.ts:29
Methods
assign()
assign<Entity, Naked, Convert, Data>(data, options?): MergeSelected<Entity, Naked, keyof Data & string>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:18
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Naked extends BaseAccount |
Convert extends boolean |
Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> |
Parameters
| Parameter | Type |
|---|---|
data | Data & IsSubset<EntityData<Naked>, Data> |
options? | AssignOptions<Convert> |
Returns
MergeSelected<Entity, Naked, keyof Data & string>
Inherited from
BaseEntity.assign
getSchema()
getSchema(): string | undefined;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:20
Returns
string | undefined
Inherited from
BaseEntity.getSchema
init()
init<Entity, Hint, Fields, Excludes>(options?): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:19
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Hint extends string |
Fields extends string |
Excludes extends string |
Parameters
| Parameter | Type |
|---|---|
options? | FindOneOptions<Entity, Hint, Fields, Excludes> |
Returns
Promise<Loaded<Entity, Hint, Fields, Excludes> | null>
Inherited from
BaseEntity.init
isInitialized()
isInitialized(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:8
Returns
boolean
Inherited from
BaseEntity.isInitialized
isTouched()
isTouched(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:9
Returns
boolean
Inherited from
BaseEntity.isTouched
populate()
populate<Entity, Hint>(populate, options?): Promise<Loaded<Entity, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:11
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Hint extends string |
Parameters
| Parameter | Type |
|---|---|
populate | false | AutoPath<Entity, Hint, never, 9>[] |
options? | EntityLoaderOptions<Entity> |
Returns
Promise<Loaded<Entity, Hint>>
Inherited from
BaseEntity.populate
populated()
populated(populated?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:10
Parameters
| Parameter | Type |
|---|---|
populated? | boolean |
Returns
void
Inherited from
BaseEntity.populated
serialize()
serialize<Entity, Naked, Hint, Exclude>(options?): EntityDTO<Loaded<Naked, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:17
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Naked extends BaseAccount |
Hint extends string |
Exclude extends string |
Parameters
| Parameter | Type |
|---|---|
options? | SerializeOptions<Naked, Hint, Exclude> |
Returns
EntityDTO<Loaded<Naked, Hint>>
Inherited from
BaseEntity.serialize
setSchema()
setSchema(schema?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:21
Parameters
| Parameter | Type |
|---|---|
schema? | string |
Returns
void
Inherited from
BaseEntity.setSchema
toObject()
Call Signature
toObject<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:13
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity>(ignoreFields): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:14
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | never[] |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity, Ignored>(ignoreFields): Omit<EntityDTO<Entity>, Ignored>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:15
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Ignored extends string |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | Ignored[] |
Returns
Omit<EntityDTO<Entity>, Ignored>
Inherited from
BaseEntity.toObject
toPOJO()
toPOJO<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:16
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toPOJO
toReference()
toReference<Entity>(): Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:12
Type Parameters
| Type Parameter |
|---|
Entity extends BaseAccount |
Returns
Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>
Inherited from
BaseEntity.toReference
abstract BaseSession
Defined in: packages/auth/src/entities/session.entity.ts:15
Extends
BaseEntity
Constructors
Constructor
new BaseSession(): BaseSession;
Returns
Inherited from
BaseEntity.constructor
Properties
createdAt
createdAt: Opt<Date>;
Defined in: packages/auth/src/entities/session.entity.ts:40
expiresAt
expiresAt: Date;
Defined in: packages/auth/src/entities/session.entity.ts:31
id
id: Opt<string>;
Defined in: packages/auth/src/entities/session.entity.ts:17
ipAddress?
optional ipAddress: Opt<string>;
Defined in: packages/auth/src/entities/session.entity.ts:34
token
token: string;
Defined in: packages/auth/src/entities/session.entity.ts:21
updatedAt
updatedAt: Opt<Date>;
Defined in: packages/auth/src/entities/session.entity.ts:47
userAgent?
optional userAgent: Opt<string>;
Defined in: packages/auth/src/entities/session.entity.ts:37
userId
userId: string;
Defined in: packages/auth/src/entities/session.entity.ts:28
Methods
assign()
assign<Entity, Naked, Convert, Data>(data, options?): MergeSelected<Entity, Naked, keyof Data & string>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:18
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Naked extends BaseSession |
Convert extends boolean |
Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> |
Parameters
| Parameter | Type |
|---|---|
data | Data & IsSubset<EntityData<Naked>, Data> |
options? | AssignOptions<Convert> |
Returns
MergeSelected<Entity, Naked, keyof Data & string>
Inherited from
BaseEntity.assign
getSchema()
getSchema(): string | undefined;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:20
Returns
string | undefined
Inherited from
BaseEntity.getSchema
init()
init<Entity, Hint, Fields, Excludes>(options?): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:19
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Hint extends string |
Fields extends string |
Excludes extends string |
Parameters
| Parameter | Type |
|---|---|
options? | FindOneOptions<Entity, Hint, Fields, Excludes> |
Returns
Promise<Loaded<Entity, Hint, Fields, Excludes> | null>
Inherited from
BaseEntity.init
isInitialized()
isInitialized(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:8
Returns
boolean
Inherited from
BaseEntity.isInitialized
isTouched()
isTouched(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:9
Returns
boolean
Inherited from
BaseEntity.isTouched
populate()
populate<Entity, Hint>(populate, options?): Promise<Loaded<Entity, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:11
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Hint extends string |
Parameters
| Parameter | Type |
|---|---|
populate | false | AutoPath<Entity, Hint, never, 9>[] |
options? | EntityLoaderOptions<Entity> |
Returns
Promise<Loaded<Entity, Hint>>
Inherited from
BaseEntity.populate
populated()
populated(populated?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:10
Parameters
| Parameter | Type |
|---|---|
populated? | boolean |
Returns
void
Inherited from
BaseEntity.populated
serialize()
serialize<Entity, Naked, Hint, Exclude>(options?): EntityDTO<Loaded<Naked, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:17
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Naked extends BaseSession |
Hint extends string |
Exclude extends string |
Parameters
| Parameter | Type |
|---|---|
options? | SerializeOptions<Naked, Hint, Exclude> |
Returns
EntityDTO<Loaded<Naked, Hint>>
Inherited from
BaseEntity.serialize
setSchema()
setSchema(schema?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:21
Parameters
| Parameter | Type |
|---|---|
schema? | string |
Returns
void
Inherited from
BaseEntity.setSchema
toObject()
Call Signature
toObject<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:13
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity>(ignoreFields): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:14
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | never[] |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity, Ignored>(ignoreFields): Omit<EntityDTO<Entity>, Ignored>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:15
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Ignored extends string |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | Ignored[] |
Returns
Omit<EntityDTO<Entity>, Ignored>
Inherited from
BaseEntity.toObject
toPOJO()
toPOJO<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:16
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toPOJO
toReference()
toReference<Entity>(): Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:12
Type Parameters
| Type Parameter |
|---|
Entity extends BaseSession |
Returns
Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>
Inherited from
BaseEntity.toReference
abstract BaseUser
Defined in: packages/auth/src/entities/user.entity.ts:13
Extends
BaseEntity
Constructors
Constructor
new BaseUser(): BaseUser;
Returns
Inherited from
BaseEntity.constructor
Properties
createdAt
createdAt: Opt<Date>;
Defined in: packages/auth/src/entities/user.entity.ts:31
email
email: string;
Defined in: packages/auth/src/entities/user.entity.ts:22
emailVerified
emailVerified: boolean;
Defined in: packages/auth/src/entities/user.entity.ts:25
id
id: Opt<string>;
Defined in: packages/auth/src/entities/user.entity.ts:15
image?
optional image: Opt<string>;
Defined in: packages/auth/src/entities/user.entity.ts:28
name
name: string;
Defined in: packages/auth/src/entities/user.entity.ts:18
updatedAt
updatedAt: Opt<Date>;
Defined in: packages/auth/src/entities/user.entity.ts:38
Methods
assign()
assign<Entity, Naked, Convert, Data>(data, options?): MergeSelected<Entity, Naked, keyof Data & string>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:18
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Naked extends BaseUser |
Convert extends boolean |
Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> |
Parameters
| Parameter | Type |
|---|---|
data | Data & IsSubset<EntityData<Naked>, Data> |
options? | AssignOptions<Convert> |
Returns
MergeSelected<Entity, Naked, keyof Data & string>
Inherited from
BaseEntity.assign
getSchema()
getSchema(): string | undefined;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:20
Returns
string | undefined
Inherited from
BaseEntity.getSchema
init()
init<Entity, Hint, Fields, Excludes>(options?): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:19
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Hint extends string |
Fields extends string |
Excludes extends string |
Parameters
| Parameter | Type |
|---|---|
options? | FindOneOptions<Entity, Hint, Fields, Excludes> |
Returns
Promise<Loaded<Entity, Hint, Fields, Excludes> | null>
Inherited from
BaseEntity.init
isInitialized()
isInitialized(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:8
Returns
boolean
Inherited from
BaseEntity.isInitialized
isTouched()
isTouched(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:9
Returns
boolean
Inherited from
BaseEntity.isTouched
populate()
populate<Entity, Hint>(populate, options?): Promise<Loaded<Entity, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:11
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Hint extends string |
Parameters
| Parameter | Type |
|---|---|
populate | false | AutoPath<Entity, Hint, never, 9>[] |
options? | EntityLoaderOptions<Entity> |
Returns
Promise<Loaded<Entity, Hint>>
Inherited from
BaseEntity.populate
populated()
populated(populated?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:10
Parameters
| Parameter | Type |
|---|---|
populated? | boolean |
Returns
void
Inherited from
BaseEntity.populated
serialize()
serialize<Entity, Naked, Hint, Exclude>(options?): EntityDTO<Loaded<Naked, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:17
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Naked extends BaseUser |
Hint extends string |
Exclude extends string |
Parameters
| Parameter | Type |
|---|---|
options? | SerializeOptions<Naked, Hint, Exclude> |
Returns
EntityDTO<Loaded<Naked, Hint>>
Inherited from
BaseEntity.serialize
setSchema()
setSchema(schema?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:21
Parameters
| Parameter | Type |
|---|---|
schema? | string |
Returns
void
Inherited from
BaseEntity.setSchema
toObject()
Call Signature
toObject<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:13
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity>(ignoreFields): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:14
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | never[] |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity, Ignored>(ignoreFields): Omit<EntityDTO<Entity>, Ignored>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:15
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Ignored extends string |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | Ignored[] |
Returns
Omit<EntityDTO<Entity>, Ignored>
Inherited from
BaseEntity.toObject
toPOJO()
toPOJO<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:16
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toPOJO
toReference()
toReference<Entity>(): Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:12
Type Parameters
| Type Parameter |
|---|
Entity extends BaseUser |
Returns
Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>
Inherited from
BaseEntity.toReference
abstract BaseVerification
Defined in: packages/auth/src/entities/verification.entity.ts:12
Extends
BaseEntity
Constructors
Constructor
new BaseVerification(): BaseVerification;
Returns
Inherited from
BaseEntity.constructor
Properties
createdAt
createdAt: Opt<Date>;
Defined in: packages/auth/src/entities/verification.entity.ts:26
expiresAt
expiresAt: Date;
Defined in: packages/auth/src/entities/verification.entity.ts:23
id
id: Opt<string>;
Defined in: packages/auth/src/entities/verification.entity.ts:14
identifier
identifier: string;
Defined in: packages/auth/src/entities/verification.entity.ts:17
updatedAt
updatedAt: Opt<Date>;
Defined in: packages/auth/src/entities/verification.entity.ts:33
value
value: string;
Defined in: packages/auth/src/entities/verification.entity.ts:20
Methods
assign()
assign<Entity, Naked, Convert, Data>(data, options?): MergeSelected<Entity, Naked, keyof Data & string>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:18
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Naked extends BaseVerification |
Convert extends boolean |
Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> |
Parameters
| Parameter | Type |
|---|---|
data | Data & IsSubset<EntityData<Naked>, Data> |
options? | AssignOptions<Convert> |
Returns
MergeSelected<Entity, Naked, keyof Data & string>
Inherited from
BaseEntity.assign
getSchema()
getSchema(): string | undefined;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:20
Returns
string | undefined
Inherited from
BaseEntity.getSchema
init()
init<Entity, Hint, Fields, Excludes>(options?): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:19
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Hint extends string |
Fields extends string |
Excludes extends string |
Parameters
| Parameter | Type |
|---|---|
options? | FindOneOptions<Entity, Hint, Fields, Excludes> |
Returns
Promise<Loaded<Entity, Hint, Fields, Excludes> | null>
Inherited from
BaseEntity.init
isInitialized()
isInitialized(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:8
Returns
boolean
Inherited from
BaseEntity.isInitialized
isTouched()
isTouched(): boolean;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:9
Returns
boolean
Inherited from
BaseEntity.isTouched
populate()
populate<Entity, Hint>(populate, options?): Promise<Loaded<Entity, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:11
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Hint extends string |
Parameters
| Parameter | Type |
|---|---|
populate | false | AutoPath<Entity, Hint, never, 9>[] |
options? | EntityLoaderOptions<Entity> |
Returns
Promise<Loaded<Entity, Hint>>
Inherited from
BaseEntity.populate
populated()
populated(populated?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:10
Parameters
| Parameter | Type |
|---|---|
populated? | boolean |
Returns
void
Inherited from
BaseEntity.populated
serialize()
serialize<Entity, Naked, Hint, Exclude>(options?): EntityDTO<Loaded<Naked, Hint>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:17
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Naked extends BaseVerification |
Hint extends string |
Exclude extends string |
Parameters
| Parameter | Type |
|---|---|
options? | SerializeOptions<Naked, Hint, Exclude> |
Returns
EntityDTO<Loaded<Naked, Hint>>
Inherited from
BaseEntity.serialize
setSchema()
setSchema(schema?): void;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:21
Parameters
| Parameter | Type |
|---|---|
schema? | string |
Returns
void
Inherited from
BaseEntity.setSchema
toObject()
Call Signature
toObject<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:13
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity>(ignoreFields): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:14
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | never[] |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toObject
Call Signature
toObject<Entity, Ignored>(ignoreFields): Omit<EntityDTO<Entity>, Ignored>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:15
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Ignored extends string |
Parameters
| Parameter | Type |
|---|---|
ignoreFields | Ignored[] |
Returns
Omit<EntityDTO<Entity>, Ignored>
Inherited from
BaseEntity.toObject
toPOJO()
toPOJO<Entity>(): EntityDTO<Entity>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:16
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Returns
EntityDTO<Entity>
Inherited from
BaseEntity.toPOJO
toReference()
toReference<Entity>(): Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
Defined in: node_modules/.pnpm/@mikro-orm+core@6.6.2/node_modules/@mikro-orm/core/entity/BaseEntity.d.ts:12
Type Parameters
| Type Parameter |
|---|
Entity extends BaseVerification |
Returns
Reference<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>
Inherited from
BaseEntity.toReference
Interfaces
AuthModuleMiddlewareOptions
Defined in: packages/auth/src/auth-module-options.interface.ts:9
Properties
excludeRoutes?
optional excludeRoutes: (string | RouteInfo)[];
Defined in: packages/auth/src/auth-module-options.interface.ts:12
includeRoutes?
optional includeRoutes: (string | RouteInfo | Type<any>)[];
Defined in: packages/auth/src/auth-module-options.interface.ts:11
register?
optional register: boolean;
Defined in: packages/auth/src/auth-module-options.interface.ts:10
AuthModuleOptions
Defined in: packages/auth/src/auth-module-options.interface.ts:15
Extends
Omit<BetterAuthOptions,"database">
Properties
account?
optional account: {
accountLinking?: {
allowDifferentEmails?: boolean;
allowUnlinkingAll?: boolean;
enabled?: boolean;
trustedProviders?: LiteralUnion<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| "email-password", string>[];
updateUserInfoOnLink?: boolean;
};
additionalFields?: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
encryptOAuthTokens?: boolean;
fields?: Partial<Record<
| "accountId"
| "providerId"
| "userId"
| "accessToken"
| "refreshToken"
| "idToken"
| "accessTokenExpiresAt"
| "refreshTokenExpiresAt"
| "scope"
| "password"
| "createdAt"
| "updatedAt", string>>;
modelName?: string;
skipStateCookieCheck?: boolean;
storeAccountCookie?: boolean;
storeStateStrategy?: "database" | "cookie";
updateAccountOnSignIn?: boolean;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7027
accountLinking?
optional accountLinking: {
allowDifferentEmails?: boolean;
allowUnlinkingAll?: boolean;
enabled?: boolean;
trustedProviders?: LiteralUnion<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| "email-password", string>[];
updateUserInfoOnLink?: boolean;
};
Configuration for account linking.
accountLinking.allowDifferentEmails?
optional allowDifferentEmails: boolean;
If enabled (true), this will allow users to manually linking accounts with different email addresses than the main user.
Default
false
⚠️ Warning: enabling this might lead to account takeovers, so proceed with caution.
accountLinking.allowUnlinkingAll?
optional allowUnlinkingAll: boolean;
If enabled (true), this will allow users to unlink all accounts.
Default
false
accountLinking.enabled?
optional enabled: boolean;
Enable account linking
Default
true
accountLinking.trustedProviders?
optional trustedProviders: LiteralUnion<
| "line"
| "github"
| "apple"
| "atlassian"
| "cognito"
| "discord"
| "facebook"
| "figma"
| "microsoft"
| "google"
| "huggingface"
| "slack"
| "spotify"
| "twitch"
| "twitter"
| "dropbox"
| "kick"
| "linear"
| "linkedin"
| "gitlab"
| "tiktok"
| "reddit"
| "roblox"
| "salesforce"
| "vk"
| "zoom"
| "notion"
| "kakao"
| "naver"
| "paybin"
| "paypal"
| "polar"
| "vercel"
| "email-password", string>[];
List of trusted providers
accountLinking.updateUserInfoOnLink?
optional updateUserInfoOnLink: boolean;
If enabled (true), this will update the user information based on the newly linked account
Default
false
additionalFields?
optional additionalFields: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
Additional fields for the account
Index Signature
[key: string]: DBFieldAttribute<DBFieldType>
encryptOAuthTokens?
optional encryptOAuthTokens: boolean;
Encrypt OAuth tokens
By default, OAuth tokens (access tokens, refresh tokens, ID tokens) are stored in plain text in the database. This poses a security risk if your database is compromised, as attackers could gain access to user accounts on external services.
When enabled, tokens are encrypted using AES-256-GCM before storage, providing protection against:
- Database breaches and unauthorized access to raw token data
- Internal threats from database administrators or compromised credentials
- Token exposure in database backups and logs
Default
false
fields?
optional fields: Partial<Record<
| "accountId"
| "providerId"
| "userId"
| "accessToken"
| "refreshToken"
| "idToken"
| "accessTokenExpiresAt"
| "refreshTokenExpiresAt"
| "scope"
| "password"
| "createdAt"
| "updatedAt", string>>;
Map fields
modelName?
optional modelName: string;
The model name for the account. Defaults to "account".
skipStateCookieCheck?
optional skipStateCookieCheck: boolean;
Skip state cookie check
⚠︎ this has security implications and should only be enabled if you know what you are doing.
Default
false
storeAccountCookie?
optional storeAccountCookie: boolean;
Store account data after oauth flow on a cookie
This is useful for database-less flow
Default
false
Note
This is automatically set to true if you haven't passed a database
storeStateStrategy?
optional storeStateStrategy: "database" | "cookie";
Strategy for storing OAuth state
- "cookie": Store state in an encrypted cookie (stateless)
- "database": Store state in the database
Default
"cookie"
updateAccountOnSignIn?
optional updateAccountOnSignIn: boolean;
When enabled (true), the user account data (accessToken, idToken, refreshToken, etc.) will be updated on sign in with the latest data from the provider.
Default
true
Inherited from
Omit.account
advanced?
optional advanced: BetterAuthAdvancedOptions;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7154
Advanced options
Inherited from
Omit.advanced
appName?
optional appName: string;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6511
The name of the application
process.env.APP_NAME
Default
"Better Auth"
Inherited from
Omit.appName
basePath?
optional basePath: string;
Defined in: packages/auth/src/auth-module-options.interface.ts:16
Base path for the Better Auth. This is typically the path where the Better Auth routes are mounted.
Default
"/api/auth"
Overrides
Omit.basePath
baseURL?
optional baseURL: string;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6520
Base URL for the Better Auth. This is typically the root URL where your application server is hosted. If not explicitly set, the system will check the following environment variable:
process.env.BETTER_AUTH_URL
Inherited from
Omit.baseURL
databaseHooks?
optional databaseHooks: {
account?: {
create?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<boolean | void>;
};
update?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
session?: {
create?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<boolean | void>;
};
update?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
user?: {
create?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<boolean | void>;
};
update?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
verification?: {
create?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<boolean | void>;
};
update?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7161
allows you to define custom hooks that can be executed during lifecycle of core database operations.
account?
optional account: {
create?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<boolean | void>;
};
update?: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
Account Hook
account.create?
optional create: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
account.create.after()?
optional after: (account, context) => Promise<void>;
Hook that is called after a account is created.
Parameters
| Parameter | Type |
|---|---|
account | { accessToken?: string | null; accessTokenExpiresAt?: Date | null; accountId: string; createdAt: Date; id: string; idToken?: string | null; password?: string | null; providerId: string; refreshToken?: string | null; refreshTokenExpiresAt?: Date | null; scope?: string | null; updatedAt: Date; userId: string; } |
account.accessToken? | string | null |
account.accessTokenExpiresAt? | Date | null |
account.accountId | string |
account.createdAt | Date |
account.id | string |
account.idToken? | string | null |
account.password? | string | null |
account.providerId | string |
account.refreshToken? | string | null |
account.refreshTokenExpiresAt? | Date | null |
account.scope? | string | null |
account.updatedAt | Date |
account.userId | string |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
account.create.before()?
optional before: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a account is created. If the hook returns false, the account will not be created. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
account | { accessToken?: string | null; accessTokenExpiresAt?: Date | null; accountId: string; createdAt: Date; id: string; idToken?: string | null; password?: string | null; providerId: string; refreshToken?: string | null; refreshTokenExpiresAt?: Date | null; scope?: string | null; updatedAt: Date; userId: string; } |
account.accessToken? | string | null |
account.accessTokenExpiresAt? | Date | null |
account.accountId | string |
account.createdAt | Date |
account.id | string |
account.idToken? | string | null |
account.password? | string | null |
account.providerId | string |
account.refreshToken? | string | null |
account.refreshTokenExpiresAt? | Date | null |
account.scope? | string | null |
account.updatedAt | Date |
account.userId | string |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
account.delete?
optional delete: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<boolean | void>;
};
account.delete.after()?
optional after: (account, context) => Promise<void>;
Hook that is called after an account is deleted.
Parameters
| Parameter | Type |
|---|---|
account | { accessToken?: ... | ... | ...; accessTokenExpiresAt?: ... | ... | ...; accountId: string; createdAt: Date; id: string; idToken?: ... | ... | ...; password?: ... | ... | ...; providerId: string; refreshToken?: ... | ... | ...; refreshTokenExpiresAt?: ... | ... | ...; scope?: ... | ... | ...; updatedAt: Date; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
account.delete.before()?
optional before: (account, context) => Promise<boolean | void>;
Hook that is called before an account is deleted. if the hook returns false, the account will not be deleted.
Parameters
| Parameter | Type |
|---|---|
account | { accessToken?: ... | ... | ...; accessTokenExpiresAt?: ... | ... | ...; accountId: string; createdAt: Date; id: string; idToken?: ... | ... | ...; password?: ... | ... | ...; providerId: string; refreshToken?: ... | ... | ...; refreshTokenExpiresAt?: ... | ... | ...; scope?: ... | ... | ...; updatedAt: Date; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<boolean | void>
account.update?
optional update: {
after?: (account, context) => Promise<void>;
before?: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
Update hook
account.update.after()?
optional after: (account, context) => Promise<void>;
Hook that is called after a account is updated.
Parameters
| Parameter | Type |
|---|---|
account | { accessToken?: ... | ... | ...; accessTokenExpiresAt?: ... | ... | ...; accountId: string; createdAt: Date; id: string; idToken?: ... | ... | ...; password?: ... | ... | ...; providerId: string; refreshToken?: ... | ... | ...; refreshTokenExpiresAt?: ... | ... | ...; scope?: ... | ... | ...; updatedAt: Date; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
account.update.before()?
optional before: (account, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a account is update. If the hook returns false, the user will not be updated. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
account | Partial<{ accessToken?: ...; accessTokenExpiresAt?: ...; accountId: ...; createdAt: ...; id: ...; idToken?: ...; password?: ...; providerId: ...; refreshToken?: ...; refreshTokenExpiresAt?: ...; scope?: ...; updatedAt: ...; userId: ...; }> & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
session?
optional session: {
create?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<boolean | void>;
};
update?: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
Session Hook
session.create?
optional create: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
session.create.after()?
optional after: (session, context) => Promise<void>;
Hook that is called after a session is created.
Parameters
| Parameter | Type |
|---|---|
session | { createdAt: Date; expiresAt: Date; id: string; ipAddress?: ... | ... | ...; token: string; updatedAt: Date; userAgent?: ... | ... | ...; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
session.create.before()?
optional before: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a session is created. if the hook returns false, the session will not be created. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
session | { createdAt: Date; expiresAt: Date; id: string; ipAddress?: ... | ... | ...; token: string; updatedAt: Date; userAgent?: ... | ... | ...; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
session.delete?
optional delete: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<boolean | void>;
};
session.delete.after()?
optional after: (session, context) => Promise<void>;
Hook that is called after a session is deleted.
Parameters
| Parameter | Type |
|---|---|
session | { createdAt: Date; expiresAt: Date; id: string; ipAddress?: ... | ... | ...; token: string; updatedAt: Date; userAgent?: ... | ... | ...; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
session.delete.before()?
optional before: (session, context) => Promise<boolean | void>;
Hook that is called before a session is deleted. if the hook returns false, the session will not be deleted.
Parameters
| Parameter | Type |
|---|---|
session | { createdAt: Date; expiresAt: Date; id: string; ipAddress?: ... | ... | ...; token: string; updatedAt: Date; userAgent?: ... | ... | ...; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<boolean | void>
session.update?
optional update: {
after?: (session, context) => Promise<void>;
before?: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
Update hook
session.update.after()?
optional after: (session, context) => Promise<void>;
Hook that is called after a session is updated.
Parameters
| Parameter | Type |
|---|---|
session | { createdAt: Date; expiresAt: Date; id: string; ipAddress?: ... | ... | ...; token: string; updatedAt: Date; userAgent?: ... | ... | ...; userId: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
session.update.before()?
optional before: (session, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a user is updated. if the hook returns false, the session will not be updated. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
session | Partial<{ createdAt: ...; expiresAt: ...; id: ...; ipAddress?: ...; token: ...; updatedAt: ...; userAgent?: ...; userId: ...; }> & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
user?
optional user: {
create?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<boolean | void>;
};
update?: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
User hooks
user.create?
optional create: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
user.create.after()?
optional after: (user, context) => Promise<void>;
Hook that is called after a user is created.
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: ... | ... | ...; name: string; updatedAt: Date; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
user.create.before()?
optional before: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a user is created. if the hook returns false, the user will not be created. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: ... | ... | ...; name: string; updatedAt: Date; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
user.delete?
optional delete: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<boolean | void>;
};
user.delete.after()?
optional after: (user, context) => Promise<void>;
Hook that is called after a user is deleted.
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: ... | ... | ...; name: string; updatedAt: Date; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
user.delete.before()?
optional before: (user, context) => Promise<boolean | void>;
Hook that is called before a user is deleted. if the hook returns false, the user will not be deleted.
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: ... | ... | ...; name: string; updatedAt: Date; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<boolean | void>
user.update?
optional update: {
after?: (user, context) => Promise<void>;
before?: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
user.update.after()?
optional after: (user, context) => Promise<void>;
Hook that is called after a user is updated.
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: ... | ... | ...; name: string; updatedAt: Date; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
user.update.before()?
optional before: (user, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a user is updated. if the hook returns false, the user will not be updated. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
user | Partial<{ createdAt: ...; email: ...; emailVerified: ...; id: ...; image?: ...; name: ...; updatedAt: ...; }> & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
verification?
optional verification: {
create?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
delete?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<boolean | void>;
};
update?: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
};
Verification Hook
verification.create?
optional create: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
verification.create.after()?
optional after: (verification, context) => Promise<void>;
Hook that is called after a verification is created.
Parameters
| Parameter | Type |
|---|---|
verification | { createdAt: Date; expiresAt: Date; id: string; identifier: string; updatedAt: Date; value: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
verification.create.before()?
optional before: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a verification is created. if the hook returns false, the verification will not be created. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
verification | { createdAt: Date; expiresAt: Date; id: string; identifier: string; updatedAt: Date; value: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
verification.delete?
optional delete: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<boolean | void>;
};
verification.delete.after()?
optional after: (verification, context) => Promise<void>;
Hook that is called after a verification is deleted.
Parameters
| Parameter | Type |
|---|---|
verification | { createdAt: Date; expiresAt: Date; id: string; identifier: string; updatedAt: Date; value: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
verification.delete.before()?
optional before: (verification, context) => Promise<boolean | void>;
Hook that is called before a verification is deleted. if the hook returns false, the verification will not be deleted.
Parameters
| Parameter | Type |
|---|---|
verification | { createdAt: Date; expiresAt: Date; id: string; identifier: string; updatedAt: Date; value: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<boolean | void>
verification.update?
optional update: {
after?: (verification, context) => Promise<void>;
before?: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
};
verification.update.after()?
optional after: (verification, context) => Promise<void>;
Hook that is called after a verification is updated.
Parameters
| Parameter | Type |
|---|---|
verification | { createdAt: Date; expiresAt: Date; id: string; identifier: string; updatedAt: Date; value: string; } & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<void>
verification.update.before()?
optional before: (verification, context) => Promise<
| boolean
| void
| {
data: ...;
}>;
Hook that is called before a verification is updated. if the hook returns false, the verification will not be updated. If the hook returns an object, it'll be used instead of the original data
Parameters
| Parameter | Type |
|---|---|
verification | Partial<{ createdAt: ...; expiresAt: ...; id: ...; identifier: ...; updatedAt: ...; value: ...; }> & Record<string, unknown> |
context | GenericEndpointContext<BetterAuthOptions> | null |
Returns
Promise<
| boolean
| void
| {
data: ...;
}>
Inherited from
Omit.databaseHooks
disabledPaths?
optional disabledPaths: string[];
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7426
Disabled paths
Paths you want to disable.
Inherited from
Omit.disabledPaths
emailAndPassword?
optional emailAndPassword: {
autoSignIn?: boolean;
disableSignUp?: boolean;
enabled: boolean;
maxPasswordLength?: number;
minPasswordLength?: number;
onPasswordReset?: (data, request?) => Promise<void>;
password?: {
hash?: (password) => Promise<string>;
verify?: (data) => Promise<boolean>;
};
requireEmailVerification?: boolean;
resetPasswordTokenExpiresIn?: number;
revokeSessionsOnPasswordReset?: boolean;
sendResetPassword?: (data, request?) => Promise<void>;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6681
Email and password authentication
autoSignIn?
optional autoSignIn: boolean;
Automatically sign in the user after sign up
Default
true
disableSignUp?
optional disableSignUp: boolean;
Disable email and password sign up
Default
false
enabled
enabled: boolean;
Enable email and password authentication
Default
false
maxPasswordLength?
optional maxPasswordLength: number;
The maximum length of the password.
Default
128
minPasswordLength?
optional minPasswordLength: number;
The minimum length of the password.
Default
8
onPasswordReset()?
optional onPasswordReset: (data, request?) => Promise<void>;
A callback function that is triggered when a user's password is changed successfully.
Parameters
| Parameter | Type |
|---|---|
data | { user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } |
data.user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } |
data.user.createdAt? | Date |
data.user.email? | string |
data.user.emailVerified? | boolean |
data.user.id? | string |
data.user.image? | string | null |
data.user.name? | string |
data.user.updatedAt? | Date |
request? | Request |
Returns
Promise<void>
password?
optional password: {
hash?: (password) => Promise<string>;
verify?: (data) => Promise<boolean>;
};
Password hashing and verification
By default Scrypt is used for password hashing and verification. You can provide your own hashing and verification function. if you want to use a different algorithm.
password.hash()?
optional hash: (password) => Promise<string>;
Parameters
| Parameter | Type |
|---|---|
password | string |
Returns
Promise<string>
password.verify()?
optional verify: (data) => Promise<boolean>;
Parameters
| Parameter | Type |
|---|---|
data | { hash: string; password: string; } |
data.hash | string |
data.password | string |
Returns
Promise<boolean>
requireEmailVerification?
optional requireEmailVerification: boolean;
Require email verification before a session can be created for the user.
if the user is not verified, the user will not be able to sign in and on sign in attempts, the user will be prompted to verify their email.
resetPasswordTokenExpiresIn?
optional resetPasswordTokenExpiresIn: number;
Number of seconds the reset password token is valid for.
Default
1 hour (60 * 60)
revokeSessionsOnPasswordReset?
optional revokeSessionsOnPasswordReset: boolean;
Whether to revoke all other sessions when resetting password
Default
false
sendResetPassword()?
optional sendResetPassword: (data, request?) => Promise<void>;
send reset password
Parameters
| Parameter | Type | Description |
|---|---|---|
data | { token: string; url: string; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | Param the user to send the reset password email to Param the URL to send the reset password email to Param the token to send to the user (could be used instead of sending the url if you need to redirect the user to custom route) |
data.token | string | - |
data.url? | string | - |
data.user? | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | - |
data.user.createdAt? | Date | - |
data.user.email? | string | - |
data.user.emailVerified? | boolean | - |
data.user.id? | string | - |
data.user.image? | string | null | - |
data.user.name? | string | - |
data.user.updatedAt? | Date | - |
request? | Request | The request object |
Returns
Promise<void>
Inherited from
Omit.emailAndPassword
emailVerification?
optional emailVerification: {
afterEmailVerification?: (user, request?) => Promise<void>;
autoSignInAfterVerification?: boolean;
expiresIn?: number;
onEmailVerification?: (user, request?) => Promise<void>;
sendOnSignIn?: boolean;
sendOnSignUp?: boolean;
sendVerificationEmail?: (data, request?) => Promise<void>;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6618
Email verification configuration
afterEmailVerification()?
optional afterEmailVerification: (user, request?) => Promise<void>;
A function that is called when a user's email is updated to verified
Parameters
| Parameter | Type | Description |
|---|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | the user that verified their email |
user.createdAt | Date | - |
user.email? | string | - |
user.emailVerified? | boolean | - |
user.id? | string | - |
user.image? | string | null | - |
user.name? | string | - |
user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
autoSignInAfterVerification?
optional autoSignInAfterVerification: boolean;
Auto signin the user after they verify their email
expiresIn?
optional expiresIn: number;
Number of seconds the verification token is valid for.
Default
3600 seconds (1 hour)
onEmailVerification()?
optional onEmailVerification: (user, request?) => Promise<void>;
A function that is called when a user verifies their email
Parameters
| Parameter | Type | Description |
|---|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | the user that verified their email |
user.createdAt | Date | - |
user.email? | string | - |
user.emailVerified? | boolean | - |
user.id? | string | - |
user.image? | string | null | - |
user.name? | string | - |
user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
sendOnSignIn?
optional sendOnSignIn: boolean;
Send a verification email automatically on sign in when the user's email is not verified
Default
false
sendOnSignUp?
optional sendOnSignUp: boolean;
Send a verification email automatically after sign up
Default
false
sendVerificationEmail()?
optional sendVerificationEmail: (data, request?) => Promise<void>;
Send a verification email
Parameters
| Parameter | Type | Description |
|---|---|---|
data | { token: string; url: string; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | the data object |
data.token | string | - |
data.url? | string | - |
data.user? | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | - |
data.user.createdAt? | Date | - |
data.user.email? | string | - |
data.user.emailVerified? | boolean | - |
data.user.id? | string | - |
data.user.image? | string | null | - |
data.user.name? | string | - |
data.user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
Inherited from
Omit.emailVerification
entities
entities: {
account: EntityClass<BaseAccount>;
session: EntityClass<BaseSession>;
user: EntityClass<BaseUser>;
verification: EntityClass<BaseVerification>;
};
Defined in: packages/auth/src/auth-module-options.interface.ts:18
account
account: EntityClass<BaseAccount>;
session
session: EntityClass<BaseSession>;
user
user: EntityClass<BaseUser>;
verification
verification: EntityClass<BaseVerification>;
experimental?
optional experimental: {
joins?: boolean;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7447
Experimental features
joins?
optional joins: boolean;
Enable experimental joins for your database adapter.
Please read the adapter documentation for more information regarding joins before enabling this. Not all adapters support joins.
Default
false
Inherited from
Omit.experimental
hooks?
optional hooks: {
after?: (inputContext) => Promise<unknown>;
before?: (inputContext) => Promise<unknown>;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7411
Hooks
after()?
optional after: (inputContext) => Promise<unknown>;
After a request is processed
Parameters
| Parameter | Type |
|---|---|
inputContext | MiddlewareInputContext<MiddlewareOptions> |
Returns
Promise<unknown>
before()?
optional before: (inputContext) => Promise<unknown>;
Before a request is processed
Parameters
| Parameter | Type |
|---|---|
inputContext | MiddlewareInputContext<MiddlewareOptions> |
Returns
Promise<unknown>
Inherited from
Omit.hooks
logger?
optional logger: Logger;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7155
Inherited from
Omit.logger
middleware?
optional middleware: AuthModuleMiddlewareOptions;
Defined in: packages/auth/src/auth-module-options.interface.ts:20
onAPIError?
optional onAPIError: {
customizeDefaultErrorPage?: {
colors?: {
background?: string;
border?: string;
cardBackground?: string;
cornerBorder?: string;
destructive?: string;
foreground?: string;
gridColor?: string;
mutedForeground?: string;
primary?: string;
primaryForeground?: string;
titleBorder?: string;
titleColor?: string;
};
disableBackgroundGrid?: boolean;
disableCornerDecorations?: boolean;
disableTitleBorder?: boolean;
font?: {
defaultFamily?: string;
monoFamily?: string;
};
size?: {
radiusLg?: string;
radiusMd?: string;
radiusSm?: string;
text2xl?: string;
text4xl?: string;
text6xl?: string;
textSm?: string;
};
};
errorURL?: string;
onError?: (error, ctx) => void | Promise<void>;
throw?: boolean;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7348
API error handling
customizeDefaultErrorPage?
optional customizeDefaultErrorPage: {
colors?: {
background?: string;
border?: string;
cardBackground?: string;
cornerBorder?: string;
destructive?: string;
foreground?: string;
gridColor?: string;
mutedForeground?: string;
primary?: string;
primaryForeground?: string;
titleBorder?: string;
titleColor?: string;
};
disableBackgroundGrid?: boolean;
disableCornerDecorations?: boolean;
disableTitleBorder?: boolean;
font?: {
defaultFamily?: string;
monoFamily?: string;
};
size?: {
radiusLg?: string;
radiusMd?: string;
radiusSm?: string;
text2xl?: string;
text4xl?: string;
text6xl?: string;
textSm?: string;
};
};
Configure the default error page provided by Better-Auth Start your dev server and go to /api/auth/error to see the error page.
customizeDefaultErrorPage.colors?
optional colors: {
background?: string;
border?: string;
cardBackground?: string;
cornerBorder?: string;
destructive?: string;
foreground?: string;
gridColor?: string;
mutedForeground?: string;
primary?: string;
primaryForeground?: string;
titleBorder?: string;
titleColor?: string;
};
customizeDefaultErrorPage.colors.background?
optional background: string;
customizeDefaultErrorPage.colors.border?
optional border: string;
customizeDefaultErrorPage.colors.cardBackground?
optional cardBackground: string;
customizeDefaultErrorPage.colors.cornerBorder?
optional cornerBorder: string;
customizeDefaultErrorPage.colors.destructive?
optional destructive: string;
customizeDefaultErrorPage.colors.foreground?
optional foreground: string;
customizeDefaultErrorPage.colors.gridColor?
optional gridColor: string;
customizeDefaultErrorPage.colors.mutedForeground?
optional mutedForeground: string;
customizeDefaultErrorPage.colors.primary?
optional primary: string;
customizeDefaultErrorPage.colors.primaryForeground?
optional primaryForeground: string;
customizeDefaultErrorPage.colors.titleBorder?
optional titleBorder: string;
customizeDefaultErrorPage.colors.titleColor?
optional titleColor: string;
customizeDefaultErrorPage.disableBackgroundGrid?
optional disableBackgroundGrid: boolean;
customizeDefaultErrorPage.disableCornerDecorations?
optional disableCornerDecorations: boolean;
customizeDefaultErrorPage.disableTitleBorder?
optional disableTitleBorder: boolean;
customizeDefaultErrorPage.font?
optional font: {
defaultFamily?: string;
monoFamily?: string;
};
customizeDefaultErrorPage.font.defaultFamily?
optional defaultFamily: string;
customizeDefaultErrorPage.font.monoFamily?
optional monoFamily: string;
customizeDefaultErrorPage.size?
optional size: {
radiusLg?: string;
radiusMd?: string;
radiusSm?: string;
text2xl?: string;
text4xl?: string;
text6xl?: string;
textSm?: string;
};
customizeDefaultErrorPage.size.radiusLg?
optional radiusLg: string;
customizeDefaultErrorPage.size.radiusMd?
optional radiusMd: string;
customizeDefaultErrorPage.size.radiusSm?
optional radiusSm: string;
customizeDefaultErrorPage.size.text2xl?
optional text2xl: string;
customizeDefaultErrorPage.size.text4xl?
optional text4xl: string;
customizeDefaultErrorPage.size.text6xl?
optional text6xl: string;
customizeDefaultErrorPage.size.textSm?
optional textSm: string;
errorURL?
optional errorURL: string;
The URL to redirect to on error
When errorURL is provided, the error will be added to the URL as a query parameter and the user will be redirected to the errorURL.
Default
- "/api/auth/error"
onError()?
optional onError: (error, ctx) => void | Promise<void>;
Custom error handler
Parameters
| Parameter | Type | Description |
|---|---|---|
error | unknown | - |
ctx | AuthContext | Auth context |
Returns
void | Promise<void>
throw?
optional throw: boolean;
Throw an error on API error
Default
false
Inherited from
Omit.onAPIError
onAuthenticated()?
optional onAuthenticated: (context) => void | Promise<void>;
Defined in: packages/auth/src/auth-module-options.interface.ts:22
Parameters
| Parameter | Type |
|---|---|
context | { req: Request; res: Response; session: Loaded<BaseSession> | null; user: Loaded<BaseUser> | null; } |
context.req | Request |
context.res | Response |
context.session | Loaded<BaseSession> | null |
context.user | Loaded<BaseUser> | null |
Returns
void | Promise<void>
plugins?
optional plugins: [] | BetterAuthPlugin[];
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6781
List of Better Auth plugins
Inherited from
Omit.plugins
rateLimit?
optional rateLimit: BetterAuthRateLimitOptions;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7150
Rate limiting configuration
Inherited from
Omit.rateLimit
secondaryStorage?
optional secondaryStorage: SecondaryStorage;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6614
Secondary storage configuration
This is used to store session and rate limit data.
Inherited from
Omit.secondaryStorage
secret?
optional secret: string;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6552
The secret to use for encryption, signing and hashing.
By default Better Auth will look for the following environment variables: process.env.BETTER_AUTH_SECRET, process.env.AUTH_SECRET If none of these environment variables are set, it will default to "better-auth-secret-123456789".
on production if it's not set it will throw an error.
you can generate a good secret using the following command:
Example
openssl rand -base64 32
Inherited from
Omit.secret
session?
optional session: {
additionalFields?: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
cookieCache?: {
enabled?: boolean;
maxAge?: number;
refreshCache?: | boolean
| {
updateAge?: number;
};
strategy?: "jwt" | "compact" | "jwe";
version?: | string
| (session, user) => string
| (session, user) => Promise<string>;
};
disableSessionRefresh?: boolean;
expiresIn?: number;
fields?: Partial<Record<
| "userId"
| "createdAt"
| "updatedAt"
| "token"
| "expiresAt"
| "ipAddress"
| "userAgent", string>>;
freshAge?: number;
modelName?: string;
preserveSessionInDatabase?: boolean;
storeSessionInDatabase?: boolean;
updateAge?: number;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6885
additionalFields?
optional additionalFields: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
Additional fields for the session
Index Signature
[key: string]: DBFieldAttribute<DBFieldType>
cookieCache?
optional cookieCache: {
enabled?: boolean;
maxAge?: number;
refreshCache?: | boolean
| {
updateAge?: number;
};
strategy?: "jwt" | "compact" | "jwe";
version?: | string
| (session, user) => string
| (session, user) => Promise<string>;
};
Enable caching session in cookie
cookieCache.enabled?
optional enabled: boolean;
Enable caching session in cookie
Default
false
cookieCache.maxAge?
optional maxAge: number;
max age of the cookie
Default
5 minutes (5 * 60)
cookieCache.refreshCache?
optional refreshCache:
| boolean
| {
updateAge?: number;
};
Controls stateless cookie cache refresh behavior.
When enabled, the cookie cache will be automatically refreshed before expiry WITHOUT querying the database. This is essential for fully stateless or DB-less scenarios.
false: Disable automatic refresh. Cache is only invalidated when it reaches maxAge expiry.true: Enable automatic refresh with default settings (refreshes when 80% of maxAge is reached).object: Custom refresh configuration with eitherupdateAgeorshouldRefreshfunction
Note: When the cache expires (reaches maxAge), it will attempt to fetch from database if available. The refreshCache option is specifically for refreshing BEFORE expiry in a stateless manner.
Type Declaration
boolean
{
updateAge?: number;
}
Default
false
cookieCache.strategy?
optional strategy: "jwt" | "compact" | "jwe";
Strategy for encoding/decoding cookie cache
- "compact": Uses base64url encoding with HMAC-SHA256 signature (compact format, no JWT spec overhead)
- "jwt": Uses JWT with HMAC signature (no encryption, follows JWT spec)
- "jwe": Uses JWE (JSON Web Encryption) with A256CBC-HS512 and HKDF key derivation for secure encrypted tokens
Default
"compact"
cookieCache.version?
optional version:
| string
| (session, user) => string
| (session, user) => Promise<string>;
Version of the cookie cache
If a cookie cache version is changed, all existing cookie caches with the old version will be invalidated.
It can be a string or a function that returns a string or a promise that returns a string. If it's a function, it will be called with the session and user data
Default
"1"
disableSessionRefresh?
optional disableSessionRefresh: boolean;
Disable session refresh so that the session is not updated
regardless of the updateAge option.
Default
false
expiresIn?
optional expiresIn: number;
Expiration time for the session token. The value should be in seconds.
Default
7 days (60 * 60 * 24 * 7)
fields?
optional fields: Partial<Record<
| "userId"
| "createdAt"
| "updatedAt"
| "token"
| "expiresAt"
| "ipAddress"
| "userAgent", string>>;
Map fields
Example
\{
userId: "user_id"
\}
###### freshAge?
```ts
optional freshAge: number;
The age of the session to consider it fresh.
This is used to check if the session is fresh for sensitive operations. (e.g. deleting an account)
If the session is not fresh, the user should be prompted to sign in again.
If set to 0, the session will be considered fresh every time. (⚠︎ not recommended)
Default
1 day (60 * 60 * 24)
modelName?
optional modelName: string;
The model name for the session.
Default
"session"
preserveSessionInDatabase?
optional preserveSessionInDatabase: boolean;
By default, sessions are deleted from the database when secondary storage is provided when session is revoked.
Set this to true to preserve session records in the database, even if they are deleted from the secondary storage.
Default
false
storeSessionInDatabase?
optional storeSessionInDatabase: boolean;
By default if secondary storage is provided the session is stored in the secondary storage.
Set this to true to store the session in the database as well.
Reads are always done from the secondary storage.
Default
false
updateAge?
optional updateAge: number;
How often the session should be refreshed. The value should be in seconds. If set 0 the session will be refreshed every time it is used.
Default
1 day (60 * 60 * 24)
Inherited from
Omit.session
socialProviders?
optional socialProviders: SocialProviders;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6777
list of social providers
Inherited from
Omit.socialProviders
telemetry?
optional telemetry: {
debug?: boolean;
enabled?: boolean;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7430
Telemetry configuration
debug?
optional debug: boolean;
Enable debug mode
Default
false
enabled?
optional enabled: boolean;
Enable telemetry collection
Default
false
Inherited from
Omit.telemetry
trustedOrigins?
optional trustedOrigins: string[] | (request) => string[] | Promise<string[]>;
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7146
List of trusted origins.
Inherited from
Omit.trustedOrigins
user?
optional user: {
additionalFields?: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
changeEmail?: {
enabled: boolean;
sendChangeEmailConfirmation?: (data, request?) => Promise<void>;
sendChangeEmailVerification?: (data, request?) => Promise<void>;
updateEmailWithoutVerification?: boolean;
};
deleteUser?: {
afterDelete?: (user, request?) => Promise<void>;
beforeDelete?: (user, request?) => Promise<void>;
deleteTokenExpiresIn?: number;
enabled?: boolean;
sendDeleteAccountVerification?: (data, request?) => Promise<void>;
};
fields?: Partial<Record<"name" | "createdAt" | "updatedAt" | "email" | "emailVerified" | "image", string>>;
modelName?: string;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:6785
User configuration
additionalFields?
optional additionalFields: {
[key: string]: DBFieldAttribute<DBFieldType>;
};
Additional fields for the user
Index Signature
[key: string]: DBFieldAttribute<DBFieldType>
changeEmail?
optional changeEmail: {
enabled: boolean;
sendChangeEmailConfirmation?: (data, request?) => Promise<void>;
sendChangeEmailVerification?: (data, request?) => Promise<void>;
updateEmailWithoutVerification?: boolean;
};
Changing email configuration
changeEmail.enabled
enabled: boolean;
Enable changing email
Default
false
changeEmail.sendChangeEmailConfirmation()?
optional sendChangeEmailConfirmation: (data, request?) => Promise<void>;
Send a confirmation email to the old email address when the user changes their email.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | { newEmail: string; token: string; url: string; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | the data object |
data.newEmail | string | - |
data.token? | string | - |
data.url? | string | - |
data.user? | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | - |
data.user.createdAt? | Date | - |
data.user.email? | string | - |
data.user.emailVerified? | boolean | - |
data.user.id? | string | - |
data.user.image? | string | null | - |
data.user.name? | string | - |
data.user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
changeEmail.sendChangeEmailVerification()?
optional sendChangeEmailVerification: (data, request?) => Promise<void>;
Send a verification email when the user changes their email.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | { newEmail: string; token: string; url: string; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | the data object |
data.newEmail | string | - |
data.token? | string | - |
data.url? | string | - |
data.user? | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | - |
data.user.createdAt? | Date | - |
data.user.email? | string | - |
data.user.emailVerified? | boolean | - |
data.user.id? | string | - |
data.user.image? | string | null | - |
data.user.name? | string | - |
data.user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
Deprecated
Use sendChangeEmailConfirmation instead
changeEmail.updateEmailWithoutVerification?
optional updateEmailWithoutVerification: boolean;
Update the email without verification if the user is not verified.
Default
false
deleteUser?
optional deleteUser: {
afterDelete?: (user, request?) => Promise<void>;
beforeDelete?: (user, request?) => Promise<void>;
deleteTokenExpiresIn?: number;
enabled?: boolean;
sendDeleteAccountVerification?: (data, request?) => Promise<void>;
};
User deletion configuration
deleteUser.afterDelete()?
optional afterDelete: (user, request?) => Promise<void>;
A function that is called after a user is deleted.
This is useful for cleaning up user data
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } |
user.createdAt | Date |
user.email? | string |
user.emailVerified? | boolean |
user.id? | string |
user.image? | string | null |
user.name? | string |
user.updatedAt? | Date |
request? | Request |
Returns
Promise<void>
deleteUser.beforeDelete()?
optional beforeDelete: (user, request?) => Promise<void>;
A function that is called before a user is deleted.
to interrupt with error you can throw APIError
Parameters
| Parameter | Type |
|---|---|
user | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } |
user.createdAt | Date |
user.email? | string |
user.emailVerified? | boolean |
user.id? | string |
user.image? | string | null |
user.name? | string |
user.updatedAt? | Date |
request? | Request |
Returns
Promise<void>
deleteUser.deleteTokenExpiresIn?
optional deleteTokenExpiresIn: number;
The expiration time for the delete token.
Default
1 day (60 * 60 * 24) in seconds
deleteUser.enabled?
optional enabled: boolean;
Enable user deletion
deleteUser.sendDeleteAccountVerification()?
optional sendDeleteAccountVerification: (data, request?) => Promise<void>;
Send a verification email when the user deletes their account.
if this is not set, the user will be deleted immediately.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | { token: string; url: string; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | the data object |
data.token | string | - |
data.url? | string | - |
data.user? | { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; } | - |
data.user.createdAt? | Date | - |
data.user.email? | string | - |
data.user.emailVerified? | boolean | - |
data.user.id? | string | - |
data.user.image? | string | null | - |
data.user.name? | string | - |
data.user.updatedAt? | Date | - |
request? | Request | the request object |
Returns
Promise<void>
fields?
optional fields: Partial<Record<"name" | "createdAt" | "updatedAt" | "email" | "emailVerified" | "image", string>>;
Map fields
Example
{
userId: "user_id"
}
modelName?
optional modelName: string;
The model name for the user. Defaults to "user".
Inherited from
Omit.user
verification?
optional verification: {
disableCleanup?: boolean;
fields?: Partial<Record<"createdAt" | "updatedAt" | "expiresAt" | "identifier" | "value", string>>;
modelName?: string;
};
Defined in: node_modules/.pnpm/@better-auth+core@1.4.7/node_modules/@better-auth/core/dist/index-NeeRjOR2.d.mts:7128
Verification configuration
disableCleanup?
optional disableCleanup: boolean;
disable cleaning up expired values when a verification value is fetched
fields?
optional fields: Partial<Record<"createdAt" | "updatedAt" | "expiresAt" | "identifier" | "value", string>>;
Map verification fields
modelName?
optional modelName: string;
Change the modelName of the verification table
Inherited from
Omit.verification
Variables
AUTH_TOKEN
const AUTH_TOKEN: typeof AUTH_TOKEN;
Defined in: packages/auth/src/auth.constants.ts:1
CurrentSession()
const CurrentSession: (...dataOrPipes) => ParameterDecorator;
Defined in: packages/auth/src/decorators/current-session.decorator.ts:4
Parameters
| Parameter | Type |
|---|---|
...dataOrPipes | unknown[] |
Returns
ParameterDecorator
CurrentUser()
const CurrentUser: (...dataOrPipes) => ParameterDecorator;
Defined in: packages/auth/src/decorators/current-user.decorator.ts:4
Parameters
| Parameter | Type |
|---|---|
...dataOrPipes | unknown[] |
Returns
ParameterDecorator
IS_PUBLIC_KEY
const IS_PUBLIC_KEY: typeof IS_PUBLIC_KEY;
Defined in: packages/auth/src/auth.constants.ts:3
Functions
Public()
function Public(value): CustomDecorator<typeof IS_PUBLIC_KEY>;
Defined in: packages/auth/src/decorators/public.decorator.ts:5
Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
CustomDecorator<typeof IS_PUBLIC_KEY>