# Not able to refresh token if mfa is eanbled (Error: mfa\_required)

**URL:** <https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947>\
**Category:** Get Help\
**Tags:** one-time-password-otp-factor, mfa\
**Created:** [December 22, 2022, 3:50am UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947 "2022-12-22T03:50:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ydeng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ydeng/32/37257_2.png) [@ydeng](https://community.auth0.com/u/ydeng)\
**Post date:** [December 22, 2022, 3:50am UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/1 "2022-12-22T03:50:22Z")

</div>

Hi there

We have enabled multi factor authentication. We are using Authorization Code Flow.  
When our angular app uses a refresh token to exchange a new access token, we got an error **mfa\_required**.

_{error: “mfa\_required”, error\_description: “Multifactor authentication required”,…}_

We have tried these suggested workaround, they are not working for us.

1. [Use Refresh Tokens](https://auth0.com/docs/secure/tokens/refresh-tokens/use-refresh-tokens#bypass-mfa)
2. [Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication)
3. [Configuring MFA Flow to require MFA once per session with Actions`](https://community.auth0.com/t/configuring-mfa-flow-to-require-mfa-once-per-session-with-actions/85059)

The end users have been authenticated with email, password and MFA code when they login, I am not sure that why the token endpoint still requires MFA when we exchange a new access token. Any suggestions or other workaround/solutions? thanks

Cheers  
Yanbo

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [December 23, 2022, 12:15am UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/2 "2022-12-23T00:15:45Z")

</div>

Hi there @ydeng welcome to the community!

You may want to look into writing an Action that utilizes the `oauth2-refresh-token` property listed under `event.transaction` here:

[https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object)

Some more on what conditional mfa may look like can be found in the following FAQ:

[https://community.auth0.com/t/how-to-enable-mfa-for-a-subset-of-users/87505](https://community.auth0.com/t/how-to-enable-mfa-for-a-subset-of-users/87505)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![sarah1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sarah1/32/33215_2.png) [@sarah1](https://community.auth0.com/u/sarah1)\
**Post date:** [January 3, 2023, 10:06pm UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/4 "2023-01-03T22:06:27Z")

</div>

It doesn’t help at all. Is there an example solution? Why isn’t this in the documentation?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 4, 2023, 10:53pm UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/5 "2023-01-04T22:53:53Z")

</div>

Hey there @sarah1!

What is your current set up? Are you using refresh tokens or standard silent auth? I’ve just tested using refresh tokens and our react sdk - Users are not required to challenge mfa again on token refresh. This typically happens (speaking to refresh token exchange in particular) when there is a rule/action enforcing mfa.

The more detail you can provide the better!

---

<div class="post-metadata">

**Author:** ![sarah1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sarah1/32/33215_2.png) [@sarah1](https://community.auth0.com/u/sarah1)\
**Post date:** [January 5, 2023, 1:50pm UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/6 "2023-01-05T13:50:00Z")

</div>

We’re working with the angular SDK. We’re using MFA on always but with the “require mfa once per session” rule. I have the AuthModule set up with useRefreshTokens = true and the cacheLocation set to localstorage and enabled offline mode in the dashboard.

I guess I’m using silent auth right now? I’m letting universal login handle the login process, but need to make the access token lifetime super short but don’t want the user to have to log in every minute. So I’m hoping to use refresh tokens but can’t due the the request (that gets made correctly) returns with an mfa\_required error.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 5, 2023, 11:12pm UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/7 "2023-01-05T23:12:01Z")

</div>

Thanks for the details!

> [@sarah1](#):
>
> I have the AuthModule set up with useRefreshTokens = true and the cacheLocation set to localstorage and enabled offline mode in the dashboard.

Are you able to locate a refresh token after auth? I assume you are also including the `offline_access` scope in the [authorize request](https://auth0.com/docs/secure/tokens/refresh-tokens/get-refresh-tokens)?

Let us know!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 7, 2023, 12:05am UTC](https://community.auth0.com/t/not-able-to-refresh-token-if-mfa-is-eanbled-error-mfa-required/96947/8 "2023-04-07T00:05:47Z")

</div>


