1

I am trying to use OTP.Net to verify login.

But I am not quite getting of how to verify the OTP. When I use this code within my one web api method the verify comes true.

var totp = new Totp(_otpSecretKey);
var totpCode = totp.ComputeTotp();
var verify = totp.VerifyTotp(totpCode, out long t);

But why in the earth I would ever want to generate and verify the otp in one single api call?

It will always be two api calls, in one api call I will send otp to the user and then when the user will put the otp and will submit the next api call will go to verify the otp.

But when I try to verify the otp in next api call it comes out false.

I must definitely be doing something wrong or my whole understanding of this library is wrong.

How can I verify the last sent otp?

Also, the usual implementation of otp includes storing the otp in database and checks it in the next call, do we still need to do it with OTP.Net library?

Because the library does not ask for particular user information so how will it verify the otp for different users.

Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105

0 Answers0