Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose mfa_token in the Auth0Error class #315

Closed
DeadHeadRussell opened this issue Apr 16, 2022 · 2 comments · Fixed by #319
Closed

Expose mfa_token in the Auth0Error class #315

DeadHeadRussell opened this issue Apr 16, 2022 · 2 comments · Fixed by #319
Labels
enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature

Comments

@DeadHeadRussell
Copy link

Describe the problem

The Auth0Error class handles the mfa_required error but does not have a way for the client to access the mfa_token field in the response body.

What was the expected behavior?

Add a way to access the underlying content parameter for the Auth0Error class or another method that allows accessing the mfa_token field.

Reproduction

from auth0.v3.authentication import GetToken

auth0_domain = ' ... '
username = ' ... some user that requires mfa to login ... '
password = ' ... '
client_id = ' ... '
auth0_audience = ' ... '

try:
    resp = GetToken(auth0_domain).login(client_id, None, username, password, None, None, auth0_audience, grant_type='password')
except Auth0Error as e:
    if e.error_code == 'mfa_required':
        e.content['mfa_token'] # This part currently doesn't exist

Environment

  • Version of this library used: 3.22.0
  • Which framework are you using, if applicable: Not applicable
  • Other modules/plugins/libraries that might be involved: None
  • Any other relevant information you think would be useful: None
@adamjmcgrath
Copy link
Contributor

Hi @DeadHeadRussell - thanks for raising this

Yep - we should add this (similar to auth0/auth0-java#123)

Will add something to the backlog and update this issue with any progress

@adamjmcgrath adamjmcgrath added the enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature label May 4, 2022
@mauricioA0
Copy link

hey @DeadHeadRussell @adamjmcgrath,

this issue is related with your MFA rule in auth0 setting.

// add privilege scope to AT
  context.accessToken.scope = requestedScopes;

  // enforce 2FA
  context.multifactor = {
      provider: 'any'
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or improvement to the SDK that could not be otherwise categorized as a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants