-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VerifyTotp is returning false randomly even Step time is not expired #43
Comments
Ensure that your server and client system times are in sync. |
I'm seeing this too, but running locally with one clock. This is for version 1.2.2. I haven't tested the new version yet. I saw on Stack Overflow someone else having this issue.. I modified their test loop, results of the first 200 loops. Is there something I'm missing? 0 for (int i = 0; i < 10000; i++) {
} |
@markbauer1975 , please see https://github.com/kspearrin/Otp.NET#expanded-time-window. You have not specified a Verification Window, so you are most likely hitting the 30-second boundary. This is evidenced by your output showing up at almost exactly 30 second intervals. The first one at 4 seconds is due to the time you started the execution - probably at 0:26 seconds after the top of a minute (4 seconds prior to a 0:30 boundary) or 0:56 seconds (4 seconds prior to the top of a minute). The documentation explains that absence of the Verification Window essentially means you only consider the current point-in-time boundary, so any time you create a code and verify it crossing a "top of the minute" or 0:30 "bottom of the minute" boundary, it will fail. Add a window that includes previous step = 1 and it should not fail using only the 1 second delay specified in your loop.
or using your code: |
Ahh Thank you! Sorry for the bad code example. After adding the VerificationWindow I don't see any errors in that test. Our application code does have that window variable. I was trying to trace down a few instances where I've seen a valid code not verify. With this ruled out, it must be something else in our code. It doesn't seem to be a time issue. Thanks again... |
The following problem assume a default expiry duration of 30 seconds is used. If I create a new token at 10:15:00 current time, it gets expired at 10:15:30 current time, which is as expected, but when I create a new token at let's say 10:15:28 current time, it is expired after 2 seconds at 10:15:30 time mark, instead of expiring after 30 seconds. I want my tokens to expire after exact 30 (or N) seconds, no matter I generate them at "top of the minute" or "bottom of the minute" boundaries. Is it possible? |
please tell me you solved it? |
@kspearrin @markbauer1975 @damiarnold @Anitha-cmd can you help me the below code ,,My problem is that the first time it's false and the second time I create code it's true, using System; namespace DmzApi.Helper.HtopCustom
} |
my expired time is 90 second |
when the randomly return false , the time output is 0 , But it's still within the effective time |
How to recalculate the remaining time of each re-generated code, I am using the current timestamp as the key encryption. |
HI , VerifyTotp is returning false randomly even Step time is not expired. Please suggest us what should we have to do now.
The text was updated successfully, but these errors were encountered: