Skip to main content
References

SuperTokens Node

Classes

default

Defined in: index.ts:33

Constructors

Constructor
new default(): default;
Returns

default

Properties

PropertyModifierTypeDefault valueDefined in
Errorstatictypeof defaultSuperTokensErrorindex.ts:36
initstatic(config) => voidSuperTokens.initindex.ts:34
RecipeUserIdstatictypeof RecipeUserIdRecipeUserIdindex.ts:37
Userstatictypeof UserUserindex.ts:38

Methods

convertToRecipeUserId()
static convertToRecipeUserId(recipeUserId): RecipeUserId;

Defined in: index.ts:167

Parameters
ParameterType
recipeUserIdstring
Returns

RecipeUserId

createUserIdMapping()
static createUserIdMapping(input): Promise<
| {
status: "OK" | "UNKNOWN_SUPERTOKENS_USER_ID_ERROR";
}
| {
doesExternalUserIdExist: boolean;
doesSuperTokensUserIdExist: boolean;
status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR";
}>;

Defined in: index.ts:88

Parameters
ParameterType
input{ externalUserId: string; externalUserIdInfo?: string; force?: boolean; superTokensUserId: string; userContext?: Record<string, any>; }
input.externalUserIdstring
input.externalUserIdInfo?string
input.force?boolean
input.superTokensUserIdstring
input.userContext?Record<string, any>
Returns

Promise< | { status: "OK" | "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; } | { doesExternalUserIdExist: boolean; doesSuperTokensUserIdExist: boolean; status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; }>

deleteUser()
static deleteUser(
userId,
removeAllLinkedAccounts,
userContext?): Promise<{
status: "OK";
}>;

Defined in: index.ts:156

Parameters
ParameterTypeDefault value
userIdstringundefined
removeAllLinkedAccountsbooleantrue
userContext?Record<string, any>undefined
Returns

Promise<{ status: "OK"; }>

deleteUserIdMapping()
static deleteUserIdMapping(input): Promise<{
didMappingExist: boolean;
status: "OK";
}>;

Defined in: index.ts:112

Parameters
ParameterType
input{ force?: boolean; userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.force?boolean
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"
Returns

Promise<{ didMappingExist: boolean; status: "OK"; }>

getAllCORSHeaders()
static getAllCORSHeaders(): string[];

Defined in: index.ts:40

Returns

string[]

getRequestFromUserContext()
static getRequestFromUserContext(userContext): BaseRequest;

Defined in: index.ts:171

Parameters
ParameterType
userContextUserContext
Returns

BaseRequest

getUser()
static getUser(userId, userContext?): Promise<User>;

Defined in: index.ts:136

Parameters
ParameterType
userIdstring
userContext?Record<string, any>
Returns

Promise<User>

getUserCount()
static getUserCount(
includeRecipeIds?,
tenantId?,
userContext?): Promise<number>;

Defined in: index.ts:44

Parameters
ParameterType
includeRecipeIds?string[]
tenantId?string
userContext?Record<string, any>
Returns

Promise<number>

getUserIdMapping()
static getUserIdMapping(input): Promise<
| {
externalUserId: string;
externalUserIdInfo: string;
status: "OK";
superTokensUserId: string;
}
| {
status: "UNKNOWN_MAPPING_ERROR";
}>;

Defined in: index.ts:101

Parameters
ParameterType
input{ userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"
Returns

Promise< | { externalUserId: string; externalUserIdInfo: string; status: "OK"; superTokensUserId: string; } | { status: "UNKNOWN_MAPPING_ERROR"; }>

getUsersNewestFirst()
static getUsersNewestFirst(input): Promise<{
nextPaginationToken?: string;
users: User[];
}>;

Defined in: index.ts:70

Parameters
ParameterType
input{ includeRecipeIds?: string[]; limit?: number; paginationToken?: string; query?: { [key: string]: string; }; tenantId: string; userContext?: Record<string, any>; }
input.includeRecipeIds?string[]
input.limit?number
input.paginationToken?string
input.query?{ [key: string]: string; }
input.tenantIdstring
input.userContext?Record<string, any>
Returns

Promise<{ nextPaginationToken?: string; users: User[]; }>

getUsersOldestFirst()
static getUsersOldestFirst(input): Promise<{
nextPaginationToken?: string;
users: User[];
}>;

Defined in: index.ts:52

Parameters
ParameterType
input{ includeRecipeIds?: string[]; limit?: number; paginationToken?: string; query?: { [key: string]: string; }; tenantId: string; userContext?: Record<string, any>; }
input.includeRecipeIds?string[]
input.limit?number
input.paginationToken?string
input.query?{ [key: string]: string; }
input.tenantIdstring
input.userContext?Record<string, any>
Returns

Promise<{ nextPaginationToken?: string; users: User[]; }>

isRecipeInitialized()
static isRecipeInitialized(recipeId): boolean;

Defined in: index.ts:175

Parameters
ParameterType
recipeIdstring
Returns

boolean

listUsersByAccountInfo()
static listUsersByAccountInfo(
tenantId,
accountInfo,
doUnionOfAccountInfo,
userContext?): Promise<User[]>;

Defined in: index.ts:143

Parameters
ParameterTypeDefault value
tenantIdstringundefined
accountInfoAccountInfoInputundefined
doUnionOfAccountInfobooleanfalse
userContext?Record<string, any>undefined
Returns

Promise<User[]>

updateOrDeleteUserIdMappingInfo()
static updateOrDeleteUserIdMappingInfo(input): Promise<{
status: "OK" | "UNKNOWN_MAPPING_ERROR";
}>;

Defined in: index.ts:124

Parameters
ParameterType
input{ externalUserIdInfo?: string; userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.externalUserIdInfo?string
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"
Returns

Promise<{ status: "OK" | "UNKNOWN_MAPPING_ERROR"; }>

RecipeUserId

Defined in: recipeUserId.ts:1

Constructors

Constructor
new RecipeUserId(recipeUserId): RecipeUserId;

Defined in: recipeUserId.ts:3

Parameters
ParameterType
recipeUserIdstring
Returns

RecipeUserId

Methods

getAsString()
getAsString(): string;

Defined in: recipeUserId.ts:10

Returns

string

User

Defined in: user.ts:91

Implements

Constructors

Constructor
new User(user): User;

Defined in: user.ts:109

Parameters
ParameterType
userUserWithoutHelperFunctions
Returns

User

Properties

PropertyModifierTypeDefined in
emailsreadonlystring[]user.ts:96
idreadonlystringuser.ts:92
isPrimaryUserreadonlybooleanuser.ts:93
loginMethodsreadonlyLoginMethod[]user.ts:105
phoneNumbersreadonlystring[]user.ts:97
tenantIdsreadonlystring[]user.ts:94
thirdPartyreadonlyobject[]user.ts:98
timeJoinedreadonlynumberuser.ts:107
webauthnreadonlyobjectuser.ts:102
webauthn.credentialIdspublicstring[]user.ts:103

Methods

toJson()
toJson(): JSONObject;

Defined in: user.ts:133

Returns

JSONObject

Implementation of
UserType.toJson
fromApi()
static fromApi(apiUser): User;

Defined in: user.ts:129

This function is used to create a User object from the API response.

Parameters
ParameterTypeDescription
apiUserOmit<UserWithoutHelperFunctions, "id"> & objectThe API response from the user endpoint.
Returns

User

A User object.

Variables

convertToRecipeUserId()

convertToRecipeUserId: (recipeUserId) => RecipeUserId = SuperTokensWrapper.convertToRecipeUserId;

Defined in: index.ts:206

Parameters

ParameterType
recipeUserIdstring

Returns

RecipeUserId

createUserIdMapping()

createUserIdMapping: (input) => Promise<
| {
status: "OK" | "UNKNOWN_SUPERTOKENS_USER_ID_ERROR";
}
| {
doesExternalUserIdExist: boolean;
doesSuperTokensUserIdExist: boolean;
status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR";
}> = SuperTokensWrapper.createUserIdMapping;

Defined in: index.ts:194

Parameters

ParameterType
input{ externalUserId: string; externalUserIdInfo?: string; force?: boolean; superTokensUserId: string; userContext?: Record<string, any>; }
input.externalUserIdstring
input.externalUserIdInfo?string
input.force?boolean
input.superTokensUserIdstring
input.userContext?Record<string, any>

Returns

Promise< | { status: "OK" | "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; } | { doesExternalUserIdExist: boolean; doesSuperTokensUserIdExist: boolean; status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; }>

deleteUser()

deleteUser: (userId, removeAllLinkedAccounts, userContext?) => Promise<{
status: "OK";
}> = SuperTokensWrapper.deleteUser;

Defined in: index.ts:192

Parameters

ParameterTypeDefault value
userIdstringundefined
removeAllLinkedAccountsbooleantrue
userContext?Record<string, any>undefined

Returns

Promise<{ status: "OK"; }>

deleteUserIdMapping()

deleteUserIdMapping: (input) => Promise<{
didMappingExist: boolean;
status: "OK";
}> = SuperTokensWrapper.deleteUserIdMapping;

Defined in: index.ts:198

Parameters

ParameterType
input{ force?: boolean; userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.force?boolean
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"

Returns

Promise<{ didMappingExist: boolean; status: "OK"; }>

Error

Error: typeof default = SuperTokensWrapper.Error;

Defined in: index.ts:212

getAllCORSHeaders()

getAllCORSHeaders: () => string[] = SuperTokensWrapper.getAllCORSHeaders;

Defined in: index.ts:184

Returns

string[]

getRequestFromUserContext()

getRequestFromUserContext: (userContext) => BaseRequest = SuperTokensWrapper.getRequestFromUserContext;

Defined in: index.ts:208

Parameters

ParameterType
userContextUserContext

Returns

BaseRequest

getUser()

getUser: (userId, userContext?) => Promise<User> = SuperTokensWrapper.getUser;

Defined in: index.ts:202

Parameters

ParameterType
userIdstring
userContext?Record<string, any>

Returns

Promise<User>

getUserCount()

getUserCount: (includeRecipeIds?, tenantId?, userContext?) => Promise<number> = SuperTokensWrapper.getUserCount;

Defined in: index.ts:186

Parameters

ParameterType
includeRecipeIds?string[]
tenantId?string
userContext?Record<string, any>

Returns

Promise<number>

getUserIdMapping()

getUserIdMapping: (input) => Promise<
| {
externalUserId: string;
externalUserIdInfo: string;
status: "OK";
superTokensUserId: string;
}
| {
status: "UNKNOWN_MAPPING_ERROR";
}> = SuperTokensWrapper.getUserIdMapping;

Defined in: index.ts:196

Parameters

ParameterType
input{ userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"

Returns

Promise< | { externalUserId: string; externalUserIdInfo: string; status: "OK"; superTokensUserId: string; } | { status: "UNKNOWN_MAPPING_ERROR"; }>

getUsersNewestFirst()

getUsersNewestFirst: (input) => Promise<{
nextPaginationToken?: string;
users: User[];
}> = SuperTokensWrapper.getUsersNewestFirst;

Defined in: index.ts:190

Parameters

ParameterType
input{ includeRecipeIds?: string[]; limit?: number; paginationToken?: string; query?: { [key: string]: string; }; tenantId: string; userContext?: Record<string, any>; }
input.includeRecipeIds?string[]
input.limit?number
input.paginationToken?string
input.query?{ [key: string]: string; }
input.tenantIdstring
input.userContext?Record<string, any>

Returns

Promise<{ nextPaginationToken?: string; users: User[]; }>

getUsersOldestFirst()

getUsersOldestFirst: (input) => Promise<{
nextPaginationToken?: string;
users: User[];
}> = SuperTokensWrapper.getUsersOldestFirst;

Defined in: index.ts:188

Parameters

ParameterType
input{ includeRecipeIds?: string[]; limit?: number; paginationToken?: string; query?: { [key: string]: string; }; tenantId: string; userContext?: Record<string, any>; }
input.includeRecipeIds?string[]
input.limit?number
input.paginationToken?string
input.query?{ [key: string]: string; }
input.tenantIdstring
input.userContext?Record<string, any>

Returns

Promise<{ nextPaginationToken?: string; users: User[]; }>

init()

init: (config) => void = SuperTokensWrapper.init;

Defined in: index.ts:182

Parameters

ParameterType
configTypeInput

Returns

void

isRecipeInitialized()

isRecipeInitialized: (recipeId) => boolean = SuperTokensWrapper.isRecipeInitialized;

Defined in: index.ts:210

Parameters

ParameterType
recipeIdstring

Returns

boolean

listUsersByAccountInfo()

listUsersByAccountInfo: (tenantId, accountInfo, doUnionOfAccountInfo, userContext?) => Promise<User[]> = SuperTokensWrapper.listUsersByAccountInfo;

Defined in: index.ts:204

Parameters

ParameterTypeDefault value
tenantIdstringundefined
accountInfoAccountInfoInputundefined
doUnionOfAccountInfobooleanfalse
userContext?Record<string, any>undefined

Returns

Promise<User[]>

updateOrDeleteUserIdMappingInfo()

updateOrDeleteUserIdMappingInfo: (input) => Promise<{
status: "OK" | "UNKNOWN_MAPPING_ERROR";
}> = SuperTokensWrapper.updateOrDeleteUserIdMappingInfo;

Defined in: index.ts:200

Parameters

ParameterType
input{ externalUserIdInfo?: string; userContext?: Record<string, any>; userId: string; userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; }
input.externalUserIdInfo?string
input.userContext?Record<string, any>
input.userIdstring
input.userIdType?"SUPERTOKENS" | "EXTERNAL" | "ANY"

Returns

Promise<{ status: "OK" | "UNKNOWN_MAPPING_ERROR"; }>

References

SuperTokensConfig

Renames and re-exports TypeInput

SuperTokensPlugin

Re-exports SuperTokensPlugin

SuperTokensPublicConfig

Re-exports SuperTokensPublicConfig

SuperTokensPublicPlugin

Re-exports SuperTokensPublicPlugin