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

# _refetchUserOnUnauthorized

## Overview

Refetches the current user when `error` is an `UnauthorizedError`, so `authPendingFlow` names the flow that
the server now requires. A request guarded by an auth flow, such as a pending sign-in or recent
authentication, answers 401 when that flow has changed. The refetch keeps the existing error and ignores
its own failure. Other errors are ignored.

## Signature

`_refetchUserOnUnauthorized(error)`

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-error">error</span> | `Error` | yes | The error from a failed request. |

### Returns

`Promise`

The refetch promise for an `UnauthorizedError`, otherwise `undefined`.

## Source

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