# Method: accounts.mfaEnrollment.finalize

- [HTTP request](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.HTTP_TEMPLATE)
- [Request body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.FinalizeMfaEnrollmentResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#body.aspect)
- [FinalizeMfaTotpEnrollmentRequestInfo](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentRequestInfo)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentRequestInfo.SCHEMA_REPRESENTATION)
- [FinalizeMfaTotpEnrollmentResponseInfo](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentResponseInfo)
- [Try it!](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#try-it)

Finishes enrolling a second factor for the user.

### HTTP request

`POST https://identitytoolkit.googleapis.com/v2/accounts/mfaEnrollment:finalize`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "idToken": string, "displayName": string, "tenantId": string, // Union field `verification_info` can be only one of the following: "phoneVerificationInfo": { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/FinalizeMfaPhoneRequestInfo`) }, "totpVerificationInfo": { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentRequestInfo`) } // End of list of possible types for union field `verification_info`. } ``` |

| Fields ||
|---|---|
| `idToken` | `string` Required. ID token. |
| `displayName` | `string` Display name which is entered by users to distinguish between different second factors with same type or different type. |
| `tenantId` | `string` The ID of the Identity Platform tenant that the user enrolling MFA belongs to. If not set, the user belongs to the default Identity Platform project. |
| Union field `verification_info`. MFA enrollment information to be verified. `verification_info` can be only one of the following: ||
| `phoneVerificationInfo` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/FinalizeMfaPhoneRequestInfo`)`` Verification info to authorize sending an SMS for phone verification. |
| `totpVerificationInfo` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentRequestInfo`)`` Verification information for TOTP. |

### Response body

mfaEnrollment.finalize response.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "idToken": string, "refreshToken": string, // Union field `auxiliary_auth_info` can be only one of the following: "phoneAuthInfo": { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/FinalizeMfaPhoneResponseInfo`) }, "totpAuthInfo": { object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentResponseInfo`) } // End of list of possible types for union field `auxiliary_auth_info`. } ``` |

| Fields ||
|---|---|
| `idToken` | `string` ID token updated to reflect MFA enrollment. |
| `refreshToken` | `string` Refresh token updated to reflect MFA enrollment. |
| Union field `auxiliary_auth_info`. MFA verified enrollment information. `auxiliary_auth_info` can be only one of the following: ||
| `phoneAuthInfo` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/FinalizeMfaPhoneResponseInfo`)`` Auxiliary auth info specific to phone auth. |
| `totpAuthInfo` | ``object (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts.mfaEnrollment/finalize#FinalizeMfaTotpEnrollmentResponseInfo`)`` Auxiliary auth info specific to TOTP auth. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/identitytoolkit`
- `
  https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## FinalizeMfaTotpEnrollmentRequestInfo

Mfa request info specific to TOTP auth for FinalizeMfa.

| JSON representation |
|---|
| ``` { "sessionInfo": string, "verificationCode": string } ``` |

| Fields ||
|---|---|
| `sessionInfo` | `string` An opaque string that represents the enrollment session. |
| `verificationCode` | `string` User-entered verification code. |

## FinalizeMfaTotpEnrollmentResponseInfo

This type has no fields.
Mfa response info specific to TOTP auth for FinalizeMfa.