Method: accounts.mfaEnrollment.start

MFA 註冊程序的第一步。如果是簡訊,系統會傳送簡訊驗證碼給使用者。

HTTP 要求

POST https://identitytoolkit.googleapis.com/v2/accounts/mfaEnrollment:start

這個網址使用 gRPC 轉碼語法。

要求主體

要求主體包含下列結構的資料:

JSON 表示法
{
  "idToken": string,
  "tenantId": string,

  // Union field enrollment_info can be only one of the following:
  "phoneEnrollmentInfo": {
    object (StartMfaPhoneRequestInfo)
  },
  "totpEnrollmentInfo": {
    object (StartMfaTotpEnrollmentRequestInfo)
  }
  // End of list of possible types for union field enrollment_info.
}
欄位
idToken

string

這是必要旗標,使用者的 ID 權杖。

tenantId

string

使用者註冊 MFA 所屬的 Identity Platform 租用戶 ID。如果未設定,使用者就會屬於預設的 Identity Platform 專案。

聯集欄位 enrollment_info。按 2 級驗證類型區分的多重驗證資訊。enrollment_info 只能是下列其中一項:
phoneEnrollmentInfo

object (StartMfaPhoneRequestInfo)

授權傳送簡訊進行電話驗證的驗證資訊。

totpEnrollmentInfo

object (StartMfaTotpEnrollmentRequestInfo)

專屬於 TOTP 驗證的登入資訊。

回應主體

mfaEnrollment.start 回應。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{

  // Union field enrollment_response can be only one of the following:
  "phoneSessionInfo": {
    object (StartMfaPhoneResponseInfo)
  },
  "totpSessionInfo": {
    object (StartMfaTotpEnrollmentResponseInfo)
  }
  // End of list of possible types for union field enrollment_response.
}
欄位
聯集欄位 enrollment_response。根據 2 因素驗證類型,回應 MFA 開始註冊的結果。enrollment_response 只能是下列其中一項:
phoneSessionInfo

object (StartMfaPhoneResponseInfo)

授權傳送簡訊進行電話驗證的驗證資訊。

totpSessionInfo

object (StartMfaTotpEnrollmentResponseInfo)

針對 TOTP 驗證的註冊回應資訊。

授權範圍

需要下列其中一種 OAuth 範圍:

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

詳情請參閱 Authentication Overview

StartMfaTotpEnrollmentRequestInfo

這個類型沒有任何欄位。

針對 StartMfa 的 TOTP 驗證,提供專屬的多重身份驗證要求資訊。

StartMfaTotpEnrollmentResponseInfo

針對 StartMfa 的 TOTP 驗證機制,專屬的 MFA 回應資訊。

JSON 表示法
{
  "sharedSecretKey": string,
  "verificationCodeLength": integer,
  "hashingAlgorithm": string,
  "periodSec": integer,
  "sessionInfo": string,
  "finalizeEnrollmentTime": string
}
欄位
sharedSecretKey

string

代表共用 TOTP 密鑰的 base 32 編碼字串。

以 32 為基數的編碼是 RFC4648#section-6 所指定的編碼。(這與 RFC3548#section-5 中的基底 32 編碼相同)。

verificationCodeLength

integer

需要產生的驗證碼長度。

hashingAlgorithm

string

用於產生驗證碼的雜湊演算法。

periodSec

integer

驗證碼變更的時間長度,單位為秒。

sessionInfo

string

代表註冊工作階段的編碼字串。

finalizeEnrollmentTime

string (Timestamp format)

註冊作業必須完成的時間。

使用 RFC 3339,產生的輸出內容一律會經過 Z 標準化,並使用 0、3、6 或 9 小數位數。系統也接受「Z」以外的偏移值。例如:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"