Home > @firebase/auth > MultiFactorError
MultiFactorError interface
The error thrown when the user needs to provide a second factor to sign in successfully.
Signature:
export interface MultiFactorError extends AuthError
Extends: AuthError
Description
The error code for this error is auth/multi-factor-auth-required
.
Example
let resolver;
let multiFactorHints;
signInWithEmailAndPassword(auth, email, password)
.then((result) => {
// User signed in. No 2nd factor challenge is needed.
})
.catch((error) => {
if (error.code == 'auth/multi-factor-auth-required') {
resolver = getMultiFactorResolver(auth, error);
multiFactorHints = resolver.hints;
} else {
// Handle other errors.
}
});
// Obtain a multiFactorAssertion by verifying the second factor.
const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
Properties
Property | Type | Description |
---|---|---|
operationType | OperationType | The type of operation (e.g., sign-in, link, or reauthenticate) during which the error was raised. |