yeojz / otplib

:key: One Time Password (OTP) / 2FA for Node.js and Browser - Supports HOTP, TOTP and Google Authenticator

Home Page:https://otplib.yeojz.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Client and Server generating different TOTP

rahul-gharat opened this issue · comments

TOTP generated at client and server for the same secret at the same time is different.
(OTP not getting validated).

I tried to play with step and window parameters but didnt worked.

Client Machine has IST timezone and the server has UTC.

I tried to check epoc time at both machines, it is same. (UTC Timestamp is same)

Can someone please help me with this? maybe i am missing something.

Thanks in advance

@rahul-gharat I have the same problem =/

I'm also seeing this in one of my services that uses this package

Hi, As a workaround I used browserify to compile otplib node module and used it at client side. Now it is working fine.
I guess npm module and unpkg module has some code difference.

Do you have any clue to what version the issue might be on, or what version I should use if I follow the steps you mentioned above

I am using otplib@12.0.0 from npm

I am using otplib@12.0.0 from npm

I'm too.