We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
exports.enableTwoFactorAuthentication = async (req, res) => { try { let data = req.body; console.log("data: ", data) const { userId, one_time_password } = data; const user = await CRMUser.findById(userId); const { tfa_auth_secret_key } = user; console.log('user', tfa_auth_secret_key, user) console.log("authenticator.check(one_time_password, tfa_auth_secret_key): ",authenticator.check(one_time_password, tfa_auth_secret_key)) if (!one_time_password || !authenticator.check(one_time_password, tfa_auth_secret_key)) { return res.status(200).send({ success: false, message: 'Invalid 2FA Code.'}); } else { user.tfa_auth_status = true; await user.save(); return res.status(200).json({ success: true, message: '2FA enabled successfully.', tfa_auth_status: true, secretKey: user.tfa_auth_secret_key, qrImage: user.tfa_auth_qr_image }); } } catch (error) { return res.status(500).json({ success: false, message: error.message }) } };
Can somebody help me?
The text was updated successfully, but these errors were encountered:
You have to use .verify() method instead of .check() in order to verify the code.
.verify()
.check()
Sorry, something went wrong.
No branches or pull requests
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.
Can somebody help me?
The text was updated successfully, but these errors were encountered: