
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 secretRecommended threads
- phantom relationships appear on parent c...
i have this bug were my past deleted collection apears as relationship to my parent collection. when i try to delete that relationship from parent it gives me e...
- Attributes Problem - Cloud
I am not able to see the attribute columns and their context on cloud. Can you help?
- Authorization header not working in Appw...
I have an Appwrite function that takes a custom bearer token as authentication. The function works fine locally when I test it with `appwrite run functions`, bu...
