constantoine/totp-rs

Time

Closed this issue · 2 comments

Hi, I have a problem with the time from my computer for example, I had seen my computer has 1 minutes less and my phone 1 minute more, so When I adjust the time from my phone one minute less equals to my computer the token code verify start working fine. Theres is a way to manage the time or something to do?, beacuse I want to use this crate for a real app in the company that Im working now.

Hi!

Thank you for taking the time to file an issue :)

There are three solutions, from the less desirable to the most. All of them stem for the fact at least one of your device is not in sync with the True Time(tm):

  • Using the "skew" parameter to allow more delay betweet the two machines, which is in my opinion only to use in case where the second solution doesn't work.

  • Make a NTP request in your rust application to get an accurate time. (if the server's time is the faulty one).

  • Force a NTP synchronisation. Be it on the mobile app if the problem lies on your phone being desynchronized (some 2fa app have an option to force clock sync), or your machine.

Thank you for your response, I will try this solutions