---
title: supertokens-web-js/recipe/multifactorauth
description: References documentation for the supertokens-web-js/recipe/multifactorauth package
sidebar:
  order: 70
---

## Classes

### default

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:22](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L22)

#### Constructors

##### Constructor

```ts check=false reason="Generated API signature"
new default(): default;
```

###### Returns

[`default`](#default)

#### Properties

| Property | Modifier | Type | Default value | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="member-default-multifactorauthclaim"></a> `MultiFactorAuthClaim` | `static` | [`MultiFactorAuthClaimClass`](#multifactorauthclaimclass) | `Recipe.MultiFactorAuthClaim` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:43](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L43) |

#### Methods

##### init()

```ts check=false reason="Generated API signature"
static init(config?): CreateRecipeFunction<"GET_MFA_INFO">;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:23](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L23)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `config?` | [`UserInput`](recipe-multifactorauth-types#userinput) |

###### Returns

[`CreateRecipeFunction`](types#createrecipefunction)\<`"GET_MFA_INFO"`\>

##### resyncSessionAndFetchMFAInfo()

```ts check=false reason="Generated API signature"
static resyncSessionAndFetchMFAInfo(input?): Promise<{
  emails: Record<string, string[] | undefined>;
  factors: MFAFactorInfo;
  fetchResponse: Response;
  phoneNumbers: Record<string, string[] | undefined>;
  status: "OK";
}>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:36](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L36)

Loads information about what factors the current session can set up/complete and updates the requirements in the session payload

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input?` | \{ `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

###### Returns

`Promise`\<\{
  `emails`: `Record`\<`string`, `string`[] \| `undefined`\>;
  `factors`: [`MFAFactorInfo`](recipe-multifactorauth-types#mfafactorinfo);
  `fetchResponse`: `Response`;
  `phoneNumbers`: `Record`\<`string`, `string`[] \| `undefined`\>;
  `status`: `"OK"`;
\}\>

`{ status: "OK", ...}` if successful

***

### MultiFactorAuthClaimClass

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:8](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L8)

We include "Class" in the class name, because it makes it easier to import/use the right thing (the instance exported by the recipe) instead of this.

#### Implements

- [`SessionClaim`](recipe-session#sessionclaim)\<[`MFAClaimValue`](recipe-multifactorauth-types#mfaclaimvalue)\>

#### Constructors

##### Constructor

```ts check=false reason="Generated API signature"
new MultiFactorAuthClaimClass(getRecipeImpl): MultiFactorAuthClaimClass;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:15](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L15)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `getRecipeImpl` | () => [`RecipeInterface`](recipe-multifactorauth-types#recipeinterface) |

###### Returns

[`MultiFactorAuthClaimClass`](#multifactorauthclaimclass)

#### Properties

| Property | Modifier | Type | Default value | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="getrecipeimpl"></a> `getRecipeImpl` | `protected` | () => [`RecipeInterface`](recipe-multifactorauth-types#recipeinterface) | `undefined` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:15](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L15) |
| <a id="id"></a> `id` | `public` | `string` | `"st-mfa"` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:9](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L9) |
| <a id="validators"></a> `validators` | `public` | `object` | `undefined` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:10](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L10) |
| `validators.hasCompletedFactors` | `public` | (`requirements`) => [`SessionClaimValidator`](recipe-session#sessionclaimvalidator) | `undefined` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:12](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L12) |
| `validators.hasCompletedMFARequirementsForAuth` | `public` | () => [`SessionClaimValidator`](recipe-session#sessionclaimvalidator) | `undefined` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:11](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L11) |

#### Methods

##### getLastFetchedTime()

```ts check=false reason="Generated API signature"
getLastFetchedTime(payload, _userContext?): number;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:138](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L138)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `payload` | `any` |
| `_userContext?` | `any` |

###### Returns

`number`

###### Implementation of

[`SessionClaim`](recipe-session#sessionclaim).[`getLastFetchedTime`](recipe-session#getlastfetchedtime)

##### getValueFromPayload()

```ts check=false reason="Generated API signature"
getValueFromPayload(payload, _userContext?): object;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:124](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L124)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `payload` | `any` |
| `_userContext?` | `any` |

###### Returns

`object`

| Name | Type | Defined in |
| ------ | ------ | ------ |
| `c` | `Record`\<`string`, `number` \| `undefined`\> | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:127](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L127) |
| `v` | `boolean` | [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:127](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L127) |

###### Implementation of

[`SessionClaim`](recipe-session#sessionclaim).[`getValueFromPayload`](recipe-session#getvaluefrompayload)

##### refresh()

```ts check=false reason="Generated API signature"
refresh(userContext): Promise<void>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts:120](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts#L120)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `userContext` | `any` |

###### Returns

`Promise`\<`void`\>

###### Implementation of

[`SessionClaim`](recipe-session#sessionclaim).[`refresh`](recipe-session#refresh)

## Variables

### init()

```ts check=false reason="Generated API signature"
const init: (config?) => CreateRecipeFunction<"GET_MFA_INFO"> = RecipeWrapper.init;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:46](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L46)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `config?` | [`UserInput`](recipe-multifactorauth-types#userinput) |

#### Returns

[`CreateRecipeFunction`](types#createrecipefunction)\<`"GET_MFA_INFO"`\>

***

### MultiFactorAuthClaim

```ts check=false reason="Generated API signature"
const MultiFactorAuthClaim: MultiFactorAuthClaimClass = RecipeWrapper.MultiFactorAuthClaim;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:48](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L48)

***

### resyncSessionAndFetchMFAInfo()

```ts check=false reason="Generated API signature"
const resyncSessionAndFetchMFAInfo: (input?) => Promise<{
  emails: Record<string, string[] | undefined>;
  factors: MFAFactorInfo;
  fetchResponse: Response;
  phoneNumbers: Record<string, string[] | undefined>;
  status: "OK";
}> = RecipeWrapper.resyncSessionAndFetchMFAInfo;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/multifactorauth/index.ts:47](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/multifactorauth/index.ts#L47)

Loads information about what factors the current session can set up/complete and updates the requirements in the session payload

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input?` | \{ `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

#### Returns

`Promise`\<\{
  `emails`: `Record`\<`string`, `string`[] \| `undefined`\>;
  `factors`: [`MFAFactorInfo`](recipe-multifactorauth-types#mfafactorinfo);
  `fetchResponse`: `Response`;
  `phoneNumbers`: `Record`\<`string`, `string`[] \| `undefined`\>;
  `status`: `"OK"`;
\}\>

`{ status: "OK", ...}` if successful

## References

### PostAPIHookContext

Re-exports [PostAPIHookContext](recipe-multifactorauth-types#postapihookcontext)

***

### PreAndPostAPIHookAction

Re-exports [PreAndPostAPIHookAction](recipe-multifactorauth-types#preandpostapihookaction)

***

### PreAPIHookContext

Re-exports [PreAPIHookContext](recipe-multifactorauth-types#preapihookcontext)

***

### RecipeFunctionOptions

Re-exports [RecipeFunctionOptions](recipe-emailpassword#recipefunctionoptions)

***

### RecipeInterface

Re-exports [RecipeInterface](recipe-multifactorauth-types#recipeinterface)

***

### UserInput

Re-exports [UserInput](recipe-multifactorauth-types#userinput)
