lucadentella / TOTP-Arduino

154 stars 33 forks source link

OTP generated by arduino using rtc and OTP generated by google authenticator does not match #10

Closed Sunam-Rijal closed 4 years ago

Sunam-Rijal commented 4 years ago

I use same code that you posted and change the hmacKey by using my own secret key from the webpage provided by you and the QR-code was scanned by google authenticator and upload code to arduino but the OTP's are different. Please suggest the solution...

lucadentella commented 4 years ago

please check the timezone, Google authentication uses UTC so you must adopt the same

Sunam-Rijal commented 4 years ago

I need to replace GMT by UTC right????

On Mon, 9 Mar 2020, 5:09 pm lucadentella, notifications@github.com wrote:

please check the timezone, Google authentication uses UTC so you must adopt the same

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lucadentella/TOTP-Arduino/issues/10?email_source=notifications&email_token=AK3HQCA5QXF2TOHDNEHO6ATRGTGXZA5CNFSM4LEGIGP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOGWUZI#issuecomment-596470373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3HQCECNUCAT7GOE2ISI5TRGTGXZANCNFSM4LEGIGPQ .

lucadentella commented 4 years ago

You must set the time on Arduino (RTC or what source you're using) to the correct UTC time... be sure that your smartphone and your arduino are in sync

Sunam-Rijal commented 4 years ago

Can you please suggest how to synchronize the time of arduino and smartphone??

lucadentella commented 4 years ago

I expect your smartphone is automatically synced with time providers.

You may use the same for Arduino:

Sunam-Rijal commented 4 years ago

ohhh, that means i need to add one more module either GPS/wifi right????

lucadentella commented 4 years ago

no, that means that you have several options to keep the time in Arduino... you can also use a simple RTC chip but it must be initialized precisely. this is a requirement for any time-based OTP. I'm closing this because it's not a issue related to the code of this library.

Sunam-Rijal commented 4 years ago

ok, thanks for answering my questions and give some idea which will be useful for my project. Thank you so much.