Skip to main content
References

EmailPassword

Classes

default

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:21

Constructors

Constructor
new default(): default;
Returns

default

Methods

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:254

Check if an 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"

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:272

Reads and returns the reset password token from the current URL

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

string

The "token" query parameter from the current location

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:286

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/emailpassword/index.ts:22

Parameters
ParameterType
config?UserInput
Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

sendPasswordResetEmail()
static sendPasswordResetEmail(input): Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
fetchResponse: Response;
reason: string;
status: "PASSWORD_RESET_NOT_ALLOWED";
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:95

Send an email to the user for password reset

Parameters
ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; reason: string; status: "PASSWORD_RESET_NOT_ALLOWED"; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; }>

{status: "OK"} if successfull

Throws

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

signIn()
static signIn(input): Promise<
| {
fetchResponse: Response;
status: "OK";
user: User;
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}
| {
fetchResponse: Response;
status: "WRONG_CREDENTIALS_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:202

Sign in a user with email and password

Parameters
ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser?boolean
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; }>

{status: "OK"} if successfull

Throws

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

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:26

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

Promise<void>

signUp()
static signUp(input): Promise<
| {
fetchResponse: Response;
status: "OK";
user: User;
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_UP_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:146

Sign up a user with email and password

Parameters
ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser?boolean
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; }>

{status: "OK"} if successfull

Throws

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

submitNewPassword()
static submitNewPassword(input): Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
fetchResponse: Response;
status: "RESET_PASSWORD_INVALID_TOKEN_ERROR";
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:49

Submit a new password for the user

Parameters
ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; }>

{status: "OK"} if successfull

Throws

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

Type Aliases

RecipeFunctionOptions

type RecipeFunctionOptions = object;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/recipeModule/types.ts:120

For the options object passed to recipe functions, we do not need a postAPIHook.

This is because these functions will be called manually, so the user always knows which API is called (making the postAPIHook redundant). They can consume the networkResponse returned by recipe functions as a way to handle post API logic

Properties

PropertyTypeDefined in
preAPIHook?(input) => Promise<{ requestInit: RequestInit; url: string; }>tmp/supertokens-web-js/lib/ts/recipe/recipeModule/types.ts:121

Variables

doesEmailExist()

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:299

Check if an 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"

getResetPasswordTokenFromURL()

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:301

Reads and returns the reset password token from the current URL

Parameters

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

Returns

string

The "token" query parameter from the current location

getTenantIdFromURL()

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:302

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/emailpassword/index.ts:294

Parameters

ParameterType
config?UserInput

Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

sendPasswordResetEmail()

const sendPasswordResetEmail: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
fetchResponse: Response;
reason: string;
status: "PASSWORD_RESET_NOT_ALLOWED";
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}> = RecipeWrapper.sendPasswordResetEmail;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:296

Send an email to the user for password reset

Parameters

ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; reason: string; status: "PASSWORD_RESET_NOT_ALLOWED"; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; }>

{status: "OK"} if successfull

Throws

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

signIn()

const signIn: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
user: User;
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}
| {
fetchResponse: Response;
status: "WRONG_CREDENTIALS_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_IN_NOT_ALLOWED";
}> = RecipeWrapper.signIn;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:298

Sign in a user with email and password

Parameters

ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser?boolean
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; }>

{status: "OK"} if successfull

Throws

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

signOut()

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

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:300

Parameters

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

Returns

Promise<void>

signUp()

const signUp: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
user: User;
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}
| {
fetchResponse: Response;
reason: string;
status: "SIGN_UP_NOT_ALLOWED";
}> = RecipeWrapper.signUp;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:297

Sign up a user with email and password

Parameters

ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser?boolean
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; }>

{status: "OK"} if successfull

Throws

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

submitNewPassword()

const submitNewPassword: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
fetchResponse: Response;
status: "RESET_PASSWORD_INVALID_TOKEN_ERROR";
}
| {
fetchResponse: Response;
formFields: object[];
status: "FIELD_ERROR";
}> = RecipeWrapper.submitNewPassword;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/emailpassword/index.ts:295

Submit a new password for the user

Parameters

ParameterType
input{ formFields: object[]; options?: RecipeFunctionOptions; userContext?: any; }
input.formFieldsobject[]
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; } | { fetchResponse: Response; formFields: object[]; status: "FIELD_ERROR"; }>

{status: "OK"} if successfull

Throws

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

References

PostAPIHookContext

Re-exports PostAPIHookContext

PreAPIHookContext

Re-exports PreAPIHookContext

RecipeInterface

Re-exports RecipeInterface

UserInput

Re-exports UserInput