Skip to main content
References

Passwordless

Classes

default

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:30

Constructors

Constructor
new default(): default;
Returns

default

Methods

clearLoginAttemptInfo()
static clearLoginAttemptInfo(input?): Promise<void>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:432

Clear any information about login attempts from storage

Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

Promise<void>

consumeCode()
static consumeCode(input?): Promise<
| {
createdNewRecipeUser: boolean;
fetchResponse: Response;
status: "OK";
user: User;
}
| {
failedCodeInputAttemptCount: number;
fetchResponse: Response;
maximumCodeInputAttempts: number;
status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
| {
fetchResponse: Response;
status: "RESTART_FLOW_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_UP_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:181

Log the user in using the input code or link code

Parameters
ParameterType
input?| { options?: RecipeFunctionOptions; userContext?: any; userInputCode: string; } | { options?: RecipeFunctionOptions; userContext?: any; }
Returns

Promise< | { createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User; } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED"; }>

{status: "OK", user, createdNewRecipeUser: bool} if succesful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

createCode()
static createCode(input): Promise<
| {
deviceId: string;
fetchResponse: Response;
flowType: PasswordlessFlowType;
preAuthSessionId: string;
status: "OK";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_UP_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:52

Create and send a code to the user for passwordless auth

Parameters
ParameterType
input| { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }
Returns

Promise< | { deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED"; }>

{status: "OK", deviceId, preAuthSessionId, flowType} If successful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

doesEmailExist()
static doesEmailExist(input): Promise<{
doesExist: boolean;
fetchResponse: Response;
status: "OK";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:338

Check if a user with the given email exists

Parameters
ParameterType
input{ email: string; options?: RecipeFunctionOptions; userContext?: any; }
input.emailstring
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK"; }>

{status: "OK", doesExist: boolean}

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

doesPhoneNumberExist()
static doesPhoneNumberExist(input): Promise<{
doesExist: boolean;
fetchResponse: Response;
status: "OK";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:362

Check if a user with the given phone number exists

Parameters
ParameterType
input{ options?: RecipeFunctionOptions; phoneNumber: string; userContext?: any; }
input.options?RecipeFunctionOptions
input.phoneNumberstring
input.userContext?any
Returns

Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK"; }>

{status: "OK", doesExist: boolean}

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

getLinkCodeFromURL()
static getLinkCodeFromURL(input?): string;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:290

Reads and returns the link code from the current URL

Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

string

The hash (#) property of the current URL

getLoginAttemptInfo()
static getLoginAttemptInfo<CustomLoginAttemptInfoProperties>(input?): Promise<object & CustomLoginAttemptInfoProperties>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:384

Get information about the current login attempt from storage

Type Parameters
Type Parameter
CustomLoginAttemptInfoProperties
Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

Promise<object & CustomLoginAttemptInfoProperties>

{deviceId, preAuthSessionId, flowType} if present, returns undefined otherwise

getPreAuthSessionIdFromURL()
static getPreAuthSessionIdFromURL(input?): string;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:304

Reads and returns the pre auth session id from the current URL

Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

string

The "preAuthSessionId" query parameter from the current URL

getTenantIdFromURL()
static getTenantIdFromURL(input?): string;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:318

Reads and returns the tenant id from the current URL

Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

string

The "tenantId" query parameter from the current location

init()
static init(config?): CreateRecipeFunction<PreAndPostAPIHookAction>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:31

Parameters
ParameterType
config?UserInput
Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

resendCode()
static resendCode(input?): Promise<{
fetchResponse: Response;
status: "OK" | "RESTART_FLOW_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:127

Resend the code to the user

Parameters
ParameterType
input?{ options?: RecipeFunctionOptions; userContext?: any; }
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR"; }>

{status: "OK"} if succesful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

setLoginAttemptInfo()
static setLoginAttemptInfo<CustomStateProperties>(input): Promise<void>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:405

Set information about the current login attempt to storage

Type Parameters
Type Parameter
CustomStateProperties
Parameters
ParameterType
input{ attemptInfo: object & CustomStateProperties; userContext?: any; }
input.attemptInfoobject & CustomStateProperties
input.userContext?any
Returns

Promise<void>

signOut()
static signOut(input?): Promise<void>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:439

Parameters
ParameterType
input?{ userContext?: any; }
input.userContext?any
Returns

Promise<void>

Variables

clearLoginAttemptInfo()

const clearLoginAttemptInfo: (input?) => Promise<void> = RecipeWrapper.clearLoginAttemptInfo;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:458

Clear any information about login attempts from storage

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

Promise<void>

consumeCode()

const consumeCode: (input?) => Promise<
| {
createdNewRecipeUser: boolean;
fetchResponse: Response;
status: "OK";
user: User;
}
| {
failedCodeInputAttemptCount: number;
fetchResponse: Response;
maximumCodeInputAttempts: number;
status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
| {
fetchResponse: Response;
status: "RESTART_FLOW_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_UP_NOT_ALLOWED";
}> = RecipeWrapper.consumeCode;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:449

Log the user in using the input code or link code

Parameters

ParameterType
input?| { options?: RecipeFunctionOptions; userContext?: any; userInputCode: string; } | { options?: RecipeFunctionOptions; userContext?: any; }

Returns

Promise< | { createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User; } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED"; }>

{status: "OK", user, createdNewRecipeUser: bool} if succesful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

createCode()

const createCode: (input) => Promise<
| {
deviceId: string;
fetchResponse: Response;
flowType: PasswordlessFlowType;
preAuthSessionId: string;
status: "OK";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_UP_NOT_ALLOWED";
}> = RecipeWrapper.createCode;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:447

Create and send a code to the user for passwordless auth

Parameters

ParameterType
input| { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }

Returns

Promise< | { deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED"; }>

{status: "OK", deviceId, preAuthSessionId, flowType} If successful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

doesEmailExist()

const doesEmailExist: (input) => Promise<{
doesExist: boolean;
fetchResponse: Response;
status: "OK";
}> = RecipeWrapper.doesEmailExist;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:450

Check if a user with the given email exists

Parameters

ParameterType
input{ email: string; options?: RecipeFunctionOptions; userContext?: any; }
input.emailstring
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK"; }>

{status: "OK", doesExist: boolean}

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

doesPhoneNumberExist()

const doesPhoneNumberExist: (input) => Promise<{
doesExist: boolean;
fetchResponse: Response;
status: "OK";
}> = RecipeWrapper.doesPhoneNumberExist;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:451

Check if a user with the given phone number exists

Parameters

ParameterType
input{ options?: RecipeFunctionOptions; phoneNumber: string; userContext?: any; }
input.options?RecipeFunctionOptions
input.phoneNumberstring
input.userContext?any

Returns

Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK"; }>

{status: "OK", doesExist: boolean}

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

getLinkCodeFromURL()

const getLinkCodeFromURL: (input?) => string = RecipeWrapper.getLinkCodeFromURL;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:453

Reads and returns the link code from the current URL

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

string

The hash (#) property of the current URL

getLoginAttemptInfo()

const getLoginAttemptInfo: <CustomLoginAttemptInfoProperties>(input?) => Promise<object & CustomLoginAttemptInfoProperties> = RecipeWrapper.getLoginAttemptInfo;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:456

Get information about the current login attempt from storage

Type Parameters

Type Parameter
CustomLoginAttemptInfoProperties

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

Promise<object & CustomLoginAttemptInfoProperties>

{deviceId, preAuthSessionId, flowType} if present, returns undefined otherwise

getPreAuthSessionIdFromURL()

const getPreAuthSessionIdFromURL: (input?) => string = RecipeWrapper.getPreAuthSessionIdFromURL;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:454

Reads and returns the pre auth session id from the current URL

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

string

The "preAuthSessionId" query parameter from the current URL

getTenantIdFromURL()

const getTenantIdFromURL: (input?) => string = RecipeWrapper.getTenantIdFromURL;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:455

Reads and returns the tenant id from the current URL

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

string

The "tenantId" query parameter from the current location

init()

const init: (config?) => CreateRecipeFunction<PreAndPostAPIHookAction> = RecipeWrapper.init;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:446

Parameters

ParameterType
config?UserInput

Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

resendCode()

const resendCode: (input?) => Promise<{
fetchResponse: Response;
status: "OK" | "RESTART_FLOW_ERROR";
}> = RecipeWrapper.resendCode;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:448

Resend the code to the user

Parameters

ParameterType
input?{ options?: RecipeFunctionOptions; userContext?: any; }
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR"; }>

{status: "OK"} if succesful

Throws

STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

setLoginAttemptInfo()

const setLoginAttemptInfo: <CustomStateProperties>(input) => Promise<void> = RecipeWrapper.setLoginAttemptInfo;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:457

Set information about the current login attempt to storage

Type Parameters

Type Parameter
CustomStateProperties

Parameters

ParameterType
input{ attemptInfo: object & CustomStateProperties; userContext?: any; }
input.attemptInfoobject & CustomStateProperties
input.userContext?any

Returns

Promise<void>

signOut()

const signOut: (input?) => Promise<void> = RecipeWrapper.signOut;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/passwordless/index.ts:452

Parameters

ParameterType
input?{ userContext?: any; }
input.userContext?any

Returns

Promise<void>

References

PostAPIHookContext

Re-exports PostAPIHookContext

PreAndPostAPIHookAction

Re-exports PreAndPostAPIHookAction

PreAPIHookContext

Re-exports PreAPIHookContext

RecipeFunctionOptions

Re-exports RecipeFunctionOptions

RecipeInterface

Re-exports RecipeInterface

UserInput

Re-exports UserInput