Multi-Factor Authentication always return false in MVC site.

Jahan Zeb asked on October 24, 2021 11:22

I am developing a MVC portal, using Kentico Identity. I am confused for following: * Once user is registered and I set the the multifactor enable for the individual user or for all but flag is always false in MVC code.

Any guidance will be appreciated.

Thank you

Recent Answers


David te Kloese answered on November 12, 2021 10:11

Hi Have you figured this out already?

Could it be the user settings are cached? What exactly are you doing to retrieve the value (any code sample)?

Does it work properly for admin interface accounts?

0 votesVote for this answer Mark as a Correct answer

Jahan Zeb answered on November 21, 2021 13:50

Thank you David,

Yes it works fine with the Admin interface, but once I try to get user profile in MVC code, flag is always false, I am trying like this:

For Login:

var user = await KenticoUserManager.FindByNameAsync(username);
if (user.TwoFactorEnabled)
{
    // TODO
}

For Registration:

User user = new User
{
    TwoFactorEnabled = true,
};

Even I tried enabling the MultiFactor from Admin Interface using User's Module.

Looking forward to you quick guidance.

Thank you,

Jahan

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.