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

# generateRecoveryCode

## Overview

Generates a new set of recovery codes for the signed-in user, replacing any existing set.
Before rejecting with an `UnauthorizedError`, refetches the current user, so `authPendingFlow` names the flow
that the server now requires.

## Signature

`generateRecoveryCode()`

### Returns

`Promise`

The allauth response, whose `data.unused_codes` lists the new codes.

## Source

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