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

verify method work with GA but not with other App

stephane-r opened this issue · comments

Describe the bug
I try to add otplib module with new side project. For this, i start to generate new user key :

const test = "lorem@ipsum.fr"
const service = "myawesomeapp"
const otpauth = authenticator.keyuri(test, service, secret)
const qrcode = await QRCode.toDataURL(otpauth)

The qrcode is correctly generated and recognized by Google Auth and FreeOTP. But, the verify method return true with correct token using Google Auth, but false (always) for other Provider (for example FreeOTP app) :

const isValid = totp.verify({ secret: "USER_TOKEN", token: "xxxxxx" })

I've try to use only totp, but i've same result with FreeOPT. I think there is something I must do wrong, but I don't see where the problem is.

Anyone have an idea ? Thank you community 💪

Details (please provide any relevant information):

  • otplib version: latest
  • os: Linux
  • browser: Mozilla latest version
  • node / yarn: 14