voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
52 lines (34 loc) • 1.47 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [MultiFactorError](./auth.multifactorerror.md)
## MultiFactorError interface
The error thrown when the user needs to provide a second factor to sign in successfully.
<b>Signature:</b>
```typescript
export interface MultiFactorError extends AuthError
```
<b>Extends:</b> [AuthError](./auth.autherror.md)
## Remarks
The error code for this error is `auth/multi-factor-auth-required`<!-- -->.
## Example
```javascript
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](./auth.multifactorerror.operationtype.md) | [OperationType](./auth.operationtype.md) | The type of operation (e.g., sign-in, link, or reauthenticate) during which the error was raised. |