question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TwoFacAuth.ValidateTwoFactorPIN every time retuns false

See original GitHub issue

bool isValid = TwoFacAuth.ValidateTwoFactorPIN(UserUniqueKey, token);

I have tried above code but, the code always returning false even if unique key and token is correct.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
ahwmcommented, Dec 4, 2019

@dfibuch Yes, I’m not sure why the default is 5 minutes where the RFC only really allows 60 (to allow the expiring code to work). But I’m glad you were able to figure out the issue!

0reactions
dfibuchcommented, Dec 4, 2019

I’ve just been playing around with the example from Dot Net Detail and had the problem where it would validate an old token, which I don’t think it should. I read through the convo here and it’s the timeout on the ValidateTwoFactorPIN method that I didn’t set, so I changed it to:

TwoFacAuth.ValidateTwoFactorPIN(UserUniqueKey, token, TimeSpan.FromSeconds(30));

And now it only validates the active token.

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net mvc - Google Authenticator ValidateTwoFactorPIN ...
I found my problem. It was with time zone. I set automatic time and zone and now is working good. thanks every body....
Read more >
Strengthening Security with Two-Factor Authentication ...
TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator(); return TwoFacAuth.ValidateTwoFactorPIN(googleAuthKey, token, validationWindow); }
Read more >
Google 2 Step Authenticator - MVC 5.0 ASP.Net C# ...
Implement google 2 step authentication in any existing MVC C# Project. ... bool status = false; //check UserName and password form our ...
Read more >
TwoFactorAuthenticator.ValidateTwoFactorPIN C# ...
Any () == false) { return(Task.FromResult(false)); } var key = result.First().Value; var validToken = twoFactorAuthenticator.ValidateTwoFactorPIN(key ...
Read more >
Implement two-factor authentication in ASP.NET Core
TwoFactorEnabled is false or a Disable two-factor authentication button ... This class will help us throughout this example, every time we ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found