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

# twoFactorAuthenticate

## Overview

Completes a two-factor sign-in with a code, then refetches the current user, which clears `authPendingFlow`.
Before rejecting with an `UnauthorizedError`, refetches the current user, so `authPendingFlow` names the flow
that the server now requires.

## Signature

`twoFactorAuthenticate(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-code">code</span> | `string` |  |  | The code from the user's device. |

### Returns

`Promise`

## Source

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