Open Closed

check 2 factor is enabled #2656


0
shobhit created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • Which api endpoint i can use to find if 2 factor is enabled

12 Answer(s)
  • 0
    maliming created
    Support Team

    hi

  • 0
    shobhit created

    Thanks @Maliming

  • 0
    maliming created
    Support Team

    : )

  • 0
    shobhit created

    Hello Maliming, We need 2 answers:

    1. Which api we can use to get the 2 factor authentication provider
    2. which api we can use to generate and confirm the 2 factor auth token
  • 0
    maliming created
    Support Team

    hi

    account\src\Volo.Abp.Account.Pro.Public.HttpApi\Volo\Abp\Account\AccountController.cs

    [HttpGet]
    [Route("two-factor-providers")]
    public virtual Task<List<string>> GetTwoFactorProvidersAsync(GetTwoFactorProvidersInput input)
    {
        return AccountAppService.GetTwoFactorProvidersAsync(input);
    }
    
    [HttpPost]
    [Route("send-two-factor-code")]
    public virtual Task SendTwoFactorCodeAsync(SendTwoFactorCodeInput input)
    {
        return AccountAppService.SendTwoFactorCodeAsync(input);
    }
    
  • 0
    shobhit created

    Hello Maliming, I am bit confused. i am using 4.2.2 and could not found both methods. i tried to implement it in seperate class but IAppService don't have such implementation. Please guide.

  • 0
    maliming created
    Support Team

    Sorry, the screenshot that I shared was the latest(5.1.x)

    You can get the account and identity module source code then copy it to your project.

  • 0
    shobhit created

    copy it to your project. you mean in API project or identity project?

  • 0
    maliming created
    Support Team

    hi

    You can choose to upgrade to the latest or copy the latest 2fa code of account and identity to your project.

  • 0
    shobhit created

    Hello maliming, I have copied account code for getting providers and getting 2 factor code. How i can verify the code? what is the api point

  • 0
    maliming created
    Support Team

    hi

    await UserManager.VerifyTwoFactorTokenAsync(user, provider, code)
    
  • 0
    shobhit created

    Thanks. it works