pyauth / pyotp

Python One-Time Password Library
https://pyauth.github.io/pyotp/
Other
2.91k stars 319 forks source link

Generated TOTP codes don't match the ones in Authenticator Apps #131

Closed LinuxDragon57 closed 2 years ago

LinuxDragon57 commented 2 years ago

I cannot get the TOTP codes generated with the library to match the ones generated by authenticator apps (namely Aegis, AndOTP, and Google Authenticator) on Android. I followed the instructions given by https://github.com/pyauth/pyotp#working-example

totp = pyotp.TOTP("seed")
print("Current OTP": totp.now())
kislyuk commented 2 years ago

Thank you for your interest in PyOTP. If you need help, please post a complete, syntactically correct reproduction of your issue, as well as the observed vs. expected behavior.

I am going to close this issue for now since it does not appear to be a bug in PyOTP. When you have a full reproduction, feel free to comment here to reopen the issue, or open a new one.

If you are fundamentally understanding and using the TOTP protocol correctly, the most likely source of the type of error that you describe is clock drift between your authenticator app and your server. You can use an NTP client to synchronize the clock with a precise time source.