Wrong Code
reginato opened this issue · comments
Hi
I have this message "Wrong Code" only on production, in my local machine is everything ok. I test this in others local machine and is it correct too.
The code on Iphone App and the generated code with "ROTP::TOTP.new("755gdkcnliwxz4v2").now.to_s" are different, even when the google_secret is the same.
Can you help me?
ps: sorry my bad english
I had a similar problem and the solution was to sync the server date/time. We have used rdate
command for that.
Also if you think your server already has the correct time, you can set a drift option to set how much the server and client time can drift apart.
I will test this.
My drift value is 31 like a document, but i will increment.
thanks
Time local: 2014-07-10 12:19:24 -0300
Time server: 2014-07-10 12:19:55 +0000
Hey @reginato looks like you nailed down the problem. You have 31 seconds of drift between your server and your local time. You might want to reset your server time.
@reginato and it looks like your server is in another Time Zone... shouldn't it have a 3 hours difference from your local? so that they would be sync
the rotp library that google-authenticator uses is TZ aware
https://github.com/mdp/rotp/blob/fc70b116d59001fac8ffca2bc2acd668ea8611b7/lib/rotp/totp.rb#L14-L64
Thanks guys works.... finally
@reginato cool! What was the fix? (just curious :)
Just incremented the drift value.
I saw this Rotp library is very usefull