Verify2FA Failed

const handle2FASubmit = async (e) => {
e.preventDefault();
setLoading(true);
try {
await signIn.verify2FA({ email, code: twoFACode });
router.push("/admin");
} catch (error) {
toast.error(error.message || "Code 2FA invalide");
setLoading(false);
}
};
const handle2FASubmit = async (e) => {
e.preventDefault();
setLoading(true);
try {
await signIn.verify2FA({ email, code: twoFACode });
router.push("/admin");
} catch (error) {
toast.error(error.message || "Code 2FA invalide");
setLoading(false);
}
};
12 Replies
Baldy
BaldyOP4mo ago
No description
Blank
Blank4mo ago
there is no signIn.verify2FA where did you get that from
Solution
Baldy
BaldyOP4mo ago
to be honest i forgot xD and as it do a network request i really think is a real thing but just no endpoint in the api 😐
Blank
Blank4mo ago
thats how better auth works the function calls are translated to api calls
Baldy
BaldyOP4mo ago
oh okay
Blank
Blank4mo ago
typescript should have thrown errors no?
Baldy
BaldyOP4mo ago
i dont use typescript 💀
Blank
Blank4mo ago
ah makes sense
Baldy
BaldyOP4mo ago
thx for help, i go check this :> isn't just to activate the 2fa on an account ?
Blank
Blank4mo ago
look there, what you want should be near there
Baldy
BaldyOP4mo ago
ah verifyTOTP work apparently for this xD thx

Did you find this page helpful?