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

Getting passcode doesn't match our records try again.

Anoupz opened this issue · comments

commented

Describe the bug
I am using the below code to generate the token.. but I get passcode doesn't match error.

import * as otplib from 'otplib'

const token = otplib.totp.generate('secret_code')

But the same works fine with pyotp lib. Any ideas??

import pyotp

totp = pyotp.TOTP('secret_code')
print("Current OTP:", totp.now())
  • otplib version: 12.0.1
  • os: Mac Os 10.15.7
  • browser: Chrome/ Cypress
  • node / yarn: 12.16.1
  • frameworks (if any): Cypress

Appreciate all the help.

Regards,
Anoop P N

commented

Found this issue using the below code helped to match the passcode

const token = otplib.authenticator.generate('secret_code')