You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is sometimes valid, sometimes it is not. I would assume that with the default window time frame of 30 seconds, and the window size of 2, which together makes 60 s, that the generated code above will always be valid as the thread.sleep lasts only 30 s. What am I doing wrong?
Thank you,
Ivan
The text was updated successfully, but these errors were encountered:
Hey, I have same issue, it worked for me for some time, but then it started bugging and the code is sometimes valid, and valid it becomes when you have like 5-10 seconds before end.
Hello,
I am trying to use your library to generate a code which will be valid for the next 60s. The code I am using is:
GoogleAuthenticatorConfigBuilder gacb =
new GoogleAuthenticatorConfigBuilder()
.setWindowSize(2);
GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build());
GoogleAuthenticatorKey googleAuthenticatorKey = googleAuthenticator.createCredentials();
String secretKey = googleAuthenticatorKey.getKey();
int code = googleAuthenticator.getTotpPassword(secretKey);
try {
Thread.sleep(30000);
} catch (InterruptedException ex) {
Logger.getLogger(MainGoogleAuthenticator.class.getName()).log(Level.SEVERE, null, ex);
}
googleAuthenticator.authorize(secretKey, code);
The code is sometimes valid, sometimes it is not. I would assume that with the default window time frame of 30 seconds, and the window size of 2, which together makes 60 s, that the generated code above will always be valid as the thread.sleep lasts only 30 s. What am I doing wrong?
Thank you,
Ivan
The text was updated successfully, but these errors were encountered: