Skip to content

2fa is not working on live server in nodejs #710

@phantomAA92

Description

@phantomAA92

Describe the bug
I've implemented optlib in node js and it's working fine on the localhost but not on the live server.

Following is the backed code where I am checking it.

const { totp, authenticator } = require('otplib');
const appName = process.env.TOTP_APP_NAME;
const label = req.user ? req.user.email : 'user';
totp.options = { window: 1 };

const secret = authenticator.generateSecret();

const qrcode = require('qrcode');
const otpauthUrl = authenticator.keyuri(label, appName, secret);

const { verificationCode, totpSecret } = req.body;
const verified = authenticator.verify(verificationCode, totpSecret);

verified is always false on live server.

can you help me this bug???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions