---
url: "https://vueda.dev/v3/reference/api/js/stores/storeUser/methods/sendTwoFactorAuthenticationCode.md"
title: "sendTwoFactorAuthenticationCode"
---

# sendTwoFactorAuthenticationCode

## Overview

Asks the server to send a two-factor code to the device of the user who is signing in or
reauthenticating, for the given method.
Before rejecting with an `UnauthorizedError`, refetches the current user, so `authPendingFlow` names the flow
that the server now requires.

## Signature

`sendTwoFactorAuthenticationCode(payload)`

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-payload">payload</span> | `object` | yes | The request body. |

#### payload Properties

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="param-payload-method">method</span> | `string` |  |  | The delivery method: `email` or `sms`. |

### Returns

`Promise`

The decoded response data; `undefined` on success.

## Source

`client/lib/stores/storeUser.js:780`
