
Hi, I always get the error messages that the token I pass is invalid although it is the one from the Authenticator App which has been added by scanning the QR code.
This is my code: async createMFA() { try { account.updateMFA(true);
TypeScript
const { secret, uri } = await account.createMfaAuthenticator(
AuthenticatorType.Totp // type
);
console.log("Authenticator URI:", uri, "Secret:", secret);
const result = await avatars.getQR(
uri, // text
800, // size (optional)
0, // margin (optional)
false // download (optional)
);
const qrString = result.toString();
console.log("QR Code String:", qrString);
return qrString
} catch (error) {
throw(error)
}
}
async activateMFA(OTP: string) {
try {
const result = await account.updateMfaAuthenticator(
AuthenticatorType.Totp, // type
OTP // otp
);
console.log(result);
if (result) {
const response = await account.updateMFA(true);
}
} catch (error) {
console.log('Error' + error)
}
}
Can someone help me please?
TL;DR
Error: Invalid Token when verifying TOTP MFA.
Developers are encountering issues with verifying TOTP MFA tokens, even though they are using the correct token from the Authenticator App. The provided code snippets show functions for creating and activating MFA.
Solution:
- Double-check that the TOTP OTP (One-Time Password) being passed in the activateMFA function is correct.
- Ensure that the implementation of the createMFA and activateMFA functions is correct and matches the server-side MFA validation process.
- Troubleshoot any discrepancies between the creation of the QR code and the scanning process to ensure accurate encoding of the secret Recommended threads
- API docs services down?
I cannot access to the API Docs, it says Invalid platfrom. the page doesn't exist
- Best practice for downwards cascade
Suppose I have the database: Books -> Chapters -> Pages And I want to be able to delete a book's chapter, and then cascade the pages in that chapter along side ...
- [SOLVED] URGENT: Project blocked
My project is blocked on Cloud for no apparent reason. I can open the project, but can't access any resources. All request are failing with 401 - general_reso...
