> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# リカバリーコードで検証

> ユーザーが登録済みデバイスを利用できない場合に、リカバリーコードを使用して MFA を検証します。

export const ResponseSchema = ({statusCode, type = "{}", children}) => {
  const [open, setOpen] = useState(false);
  return <div className="border border-gray-100 dark:border-gray-800 rounded-lg mb-3 overflow-hidden">
      <div className={`flex items-center gap-2.5 px-4 py-2.5 cursor-pointer select-none ${open ? "bg-gray-50 dark:bg-gray-800" : ""}`} onClick={() => setOpen(!open)}>
        {statusCode && <span className="border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 font-mono text-xs px-1.5 py-0.5 rounded">
            {statusCode.startsWith("default") ? "default" : statusCode}
          </span>}
        <span className="text-gray-500 dark:text-gray-400 text-sm font-mono">
          {type}
        </span>
        <span className="text-gray-400 dark:text-gray-500 text-sm italic">
          application/json
        </span>
        <svg className={`ml-auto opacity-50 transition-transform duration-200 ${open ? "rotate-180" : ""}`} width="16" height="16" viewBox="0 0 16 16" fill="none">
          <path d="M4 6l4 4 4-4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
        </svg>
      </div>
      {open && <div className="px-4 pt-1 pb-3 border-t border-gray-100 dark:border-gray-800">
          {children}
        </div>}
    </div>;
};

<div id="endpoint">
  ## エンドポイント
</div>

`POST /oauth/token`

回復コードを使用して多要素認証 (MFA) を検証します。一部の多要素認証 (MFA) プロバイダー (Guardian など) では、ログイン時に回復コードを使用できます。ユーザーが登録済みデバイスを利用できない場合や、接続の問題によってチャレンジを受信または承認できない場合は、このメソッドを使用して認証します。

回復コードを使用して MFA を検証するには、アプリでユーザーに回復コードの入力を求め、`grant_type=http://auth0.com/oauth/grant-type/mfa-recovery-code` を指定して `/oauth/token` にリクエストを送信する必要があります。入力された回復コードと、`mfa_required` エラーで返される `mfa_token` を含めてください。回復コードが受け入れられた場合、レスポンスは `password` または `http://auth0.com/oauth/grant-type/password-realm` の grant type と同じになります。また、`recovery_code` フィールドが含まれることもあります。その場合、アプリケーションは今後使用できるよう、エンドユーザーに表示して安全に保管してもらう必要があります。

<div id="headers">
  ## ヘッダー
</div>

<ParamField header="DPoP" type="string">
  リクエストの DPoP プルーフです。これは省略可能で、アプリケーションで Demonstrating Proof-of-Possession を使用している場合にのみ必要です。
</ParamField>

<div id="body-parameters">
  ## ボディパラメーター
</div>

<ParamField body="grant_type" type="string" required>
  使用するフローを示します。リカバリーコードの場合は `http://auth0.com/oauth/grant-type/mfa-recovery-code` を使用します。

  使用可能な値: `http://auth0.com/oauth/grant-type/mfa-recovery-code`
</ParamField>

<ParamField body="client_id" type="string" required>
  アプリケーションのクライアントID。
</ParamField>

<ParamField body="client_assertion" type="string">
  アプリケーションの認証情報を含む、署名付きアサーションを格納した JWT。
</ParamField>

<ParamField body="client_assertion_type" type="string">
  値は `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` です。

  使用可能な値: `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`
</ParamField>

<ParamField body="client_secret" type="string">
  アプリケーションのクライアントシークレット。
</ParamField>

<ParamField body="mfa_token" type="string" required>
  `mfa_required` エラーで受け取った `mfa_token`。
</ParamField>

<ParamField body="recovery_code" type="string" required>
  エンドユーザーから提供されたリカバリーコード。
</ParamField>

<div id="response-schema">
  ## レスポンススキーマ
</div>

<ResponseSchema>
  <ResponseField name="access_token" type="string">
    検証に成功した際のアクセストークンです。
  </ResponseField>

  <ResponseField name="token_type" type="string">
    発行されたトークンの種類です。
  </ResponseField>

  <ResponseField name="expires_in" type="integer">
    アクセストークンの有効期間 (秒) です。
  </ResponseField>

  <ResponseField name="recovery_code" type="string">
    今後使用できるよう、安全に保管するための新しい回復コードです。
  </ResponseField>
</ResponseSchema>

<div id="response-messages">
  ## レスポンスメッセージ
</div>

| Status | Description                                |
| ------ | ------------------------------------------ |
| 200    | 回復コードの検証に成功した場合のレスポンスです。                   |
| 400    | パラメーターが不足しているか無効なため、不正なリクエストです。            |
| 401    | 未認証です。mfa\_token または recovery\_code が無効です。 |
