Can't get mfa_token from react-native-auth0 SDK

Please include the following information in your post:

  • Which SDK this is regarding:
    react-native-auth0
  • SDK Version: 2.13.3
  • Platform Version: react-native: “0.67.1”,

Hello people, I am trying to get the mfa_token from the below method:

export async function login(email, password) {
  const response = await auth0.auth.passwordRealm({
    username: email,
    password: password,
    realm: 'Username-Password-Authentication',
  });
  return response.accessToken;

the problem is that I don’t t get the mfa access token from the catch response, I am only getting this message: [mfa_required: Multifactor authentication required]. without the mfa access token.

I already granted MFA permission to my app, and I was able to get the MFA token by calling directly the API by postman:

but from the React Native Auth0 SDK using passwordRealm function I am not able.

Does anyone knows what I am doing wrong?

Solution:
In my Catch error I should concatenate the json string in order to display the mfa token, like in the example below:
.catch(error => console.log(error.json));

before I had it like this:
.catch(error => console.log(error));

1 Like

Awesome, thanks for the update and solution @alberto.ivan92 - Also, welcome to the community! :smile:

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