Auth0 Home Blog Docs

React auth0-js MFA

mfa
react

#1

Hi All,

I was wondering if anyone had any example code of getting an optional MFA enrolment process working with a React application. Essentially, what I am trying to get working is a custom signup/login process (currently working, but with no multi-factor) that will then give the user an option of adding multi-factor to their account, or for certain user roles (maintained in a custom third party DB), forcing it.

I am having a lot of trouble finding anything I can use for React to get the enrolment process for MFA working post-custom signup process I have created (it needs to be user initiated), using the auth0-js package. When calling endpoints such as /oauth/token (in an attempt to get the mfa_token to then associate either SMS or OTP) with the users current access_token I am simply getting a 401 Unauthorized error. I’m sure I’m doing something very basically wrong here, but the documentation isn’t helping me figure out what (especially with a lack of any code that works with React specifically!).

Any help is greatly appreciated!


#3

Hey there @evan.ractivand, I would love to find out more about your React app you are building so we can better assist. I have linked some standard MFA documentation below as a reference point for historical context. You stated you are getting a 401 Unauthorized on the callback but I would like to dig more into this via a HAR file capture which can be obtained by following this procedure here and then DMing it over to me with your corresponding tenant name. Thanks in advance!



#5

Hey there @evan.ractivand I wanted to reach out and let you know I sent you a DM, when you get a free minute can you give it a glance. Thanks!