-
|
How to validate the |
Beta Was this translation helpful? Give feedback.
Answered by
jchambers
Apr 10, 2026
Replies: 1 comment
-
|
From a mechanical perspective: generate the expected code, then check if the provided code matches the expected code. For example: if (providedOneTimePasswordString.equals(totp.generateOneTimePasswordString(key, timestamp)) {
// Success!
}…but please note that there are lots of other factors to consider! How much clock drift will you allow? How many times is a user allowed to retry? What happens when a user exceeds that limit? These (and other) considerations are discussed in greater detail in:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jchambers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From a mechanical perspective: generate the expected code, then check if the provided code matches the expected code. For example:
…but please note that there are lots of other factors to consider! How much clock drift will you allow? How many times is a user allowed to retry? What happens when a user exceeds that limit? These (and other) considerations are discussed in greater detail in: