Create and verify a challenge
Helper method which creates a challenge and immediately uses the given code to verify against it thereafter. The verification code is provided by the user by entering a code seen in their authenticator app.
- An enrolled factor is required before invoking
challengeAndVerify()
. - Executes
mfa.challenge()
andmfa.verify()
in a single step.
Parameters
- paramsREQUIREDMFAChallengeAndVerifyParamsfactorIdREQUIREDstring
ID of the factor being verified. Returned in enroll().
codeREQUIREDstringVerification code provided by the user.
const { data, error } = await supabase.auth.mfa.challengeAndVerify({
factorId: '34e770dd-9ff9-416c-87fa-43b31d7ef225',
code: '123456'
})