
Hello
I want to set up the MFA for the user accounts in JS (react) and fail repeatedly (WebSDK appwrite 14.0 with appwrite 1.5.4.).
Instructions used: https://appwrite.io/docs/products/auth/2fa
Account created with updateMFA(true);
MFA page
useEffect(() => {
const generateTOTP = async () => {
try {
const response = await account.get();
} catch (error) {
console.log(error);
if (error.type === 'user_more_factors_required') {
const factors = await account.listFactors();
console.log("factors", factors)
const { backups, secret, uri } = await account.addAuthenticator('totp');
setBackups(backups);
setSecret(secret);
setUri(uri);
const QRCode = await avatars.getQR(uri);
setQrCode(QRCode);
console.log(QRCode.href);
const challenge = await account.createChallenge("totp");
setChallengeId(challenge.$id);
} else {
console.error(error);
}
}
};
generateTOTP();
}, []);
Error:
TypeError: account.listFactors is not a function
Is there a good example in JS?
What am I doing wrong?
Thank you very much for your help.
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
