# MFA API doesn't return recovery\_codes

**URL:** <https://community.auth0.com/t/mfa-api-doesnt-return-recovery-codes/186175>\
**Category:** Get Help\
**Tags:** recovery-code-factor, mfa\
**Created:** [May 1, 2025, 4:41am UTC](https://community.auth0.com/t/mfa-api-doesnt-return-recovery-codes/186175 "2025-05-01T04:41:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.fukao](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/t.fukao/32/61052_2.png) [@t.fukao](https://community.auth0.com/u/t.fukao)\
**Post date:** [May 1, 2025, 4:41am UTC](https://community.auth0.com/t/mfa-api-doesnt-return-recovery-codes/186175/1 "2025-05-01T04:41:50Z")

</div>

I’m trying to enroll a user’s authenticator using the MFA API.

```auto
$response = Http::withHeaders([
    'Authorization' => 'Bearer ' . $request->mfa_token,
    'Content-Type' => 'application/json',
])->post('https:// { MY_DOMAIN } /mfa/associate', [
    'authenticator_types' => ['otp'],
]);

```

According to [this](https://auth0.com/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-otp-authenticators#enroll-authenticator), the response should inclueds the `recovery_codes`.  
However, I’m not seeing any.

```auto
{
    "authenticator_type": "otp",
    "secret": " ******",
    "barcode_uri": "otpauth://totp/ ******"
}

```

I’m using the following method to check if it’s the user’s first authenticator association.  
The MFA API is used only when it results in `false`.

```auto
$get_factor_api = Auth0::management()
    ->users()
    ->getAuthenticationMethods(
        user: Auth::id(),
    );
    $get_factor_api_response = json_decode($get_factor_api->getBody()->getContents());

    return count($get_factor_api_response) > 0 ? true : false;

```

( I’m using the [laravel-auth0](https://github.com/auth0/laravel-auth0/tree/main) )

The scopes in the MFA token are `openid`, `profile`, `email`, `enroll` and `offline_access`.

Is there something wrong?

---

<div class="post-metadata">

**Author:** ![t.fukao](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/t.fukao/32/61052_2.png) [@t.fukao](https://community.auth0.com/u/t.fukao)\
**Post date:** [May 1, 2025, 6:17am UTC](https://community.auth0.com/t/mfa-api-doesnt-return-recovery-codes/186175/2 "2025-05-01T06:17:38Z")

</div>

I’ve found the solution.  
**Dashboard → Security → Multi-factor Auth** , and toggle **Recovery codes** on.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 15, 2025, 6:17am UTC](https://community.auth0.com/t/mfa-api-doesnt-return-recovery-codes/186175/3 "2025-05-15T06:17:56Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
