Base solution for your next web application
Open Closed

Two Factor Authentication for React Native #9322


User avatar
0
andry3ag created

Hi Team,

I can see that ASP.NET Zero supports Two Factor Authentication, and I can see how to enable those using the Angular application.We wanted to implement Two Factor Authentication on our own mobile app using React native. Given I have enabled two factor authentication using the tenant adminstration page. Can you please describe the flow that needs to be implemented?

Thanks


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @andry3ag,

    Your Authenticate request returns something like this when two factor is enabled;

    RequiresTwoFactorVerification = true,
    UserId = "{USERID}",
    TwoFactorAuthProviders = "{LIST_OF_PROVIDERS}",
    ReturnUrl = "{RETURN_URL}"
    

    When you receive such a result, you should allow user to select one of the providers returned in TwoFactorAuthProviders. When user selects one of them, you need to make a request to TokenAuth/SendTwoFactorAuthCode. In the next screen, there must be a code for entering two factor code. When user enters the two factor code, you need to make a request to Authanticate method again with TwoFactorVerificationCode. After all, you should receive a valid token and user logins to the system.