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

Cannot verify token with microsoft W10 OS (EDGE & Firefox)

stephdl opened this issue · comments

Describe the bug

Hi
Not sure it is bug, or I am the bug, I can verify a 6 digit pin on Linux with chrome and firefox, on apple with safari but it fails when a user uses W10 with EDGE (80) and Firefox (74)

To Reproduce
Steps to reproduce the behavior:

install the last version in my webpack

npm install otplib --save

import the library in my web page

import { authenticator } from 'otplib';

then test with a function

    testToken(token) {
      var context = this;
      var secret = context.otp.Secret;
      
      context.otp.TokenIsValid = authenticator.verify({ token, secret });
      
      if (context.otp.TokenIsValid) {
        context.otp.TokenValidationError = false;
      }
      else if (!context.otp.TokenIsValid) {
        context.otp.TokenValidationError = true;
      }
    },

Expected behavior

On linux ( using the FF or chrome) or apple (safari), if the time based code I can read on freeOTP is good I have true, if it is wrong I have false, but with W10 (EDGE and Firefox) I have always wrong.

Details (please provide any relevant information):

  • otplib version: V12
  • os: W10
  • browser: EDGE version 80 Firefox version 74
  • node / yarn: nodejs-12.16.1-1.fc31.x86_64
  • frameworks (if any):

Sorry for the noise, I cannot reproduce the issue, let's close it.