> ## 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.

> Auth0 MFA API を使用するアプリケーションで、MFA 認証要素の登録を管理する方法を説明します。

# Authentication API で認証要素を管理する

export const AuthCodeGroup = ({children, dropdown}) => {
  const [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        const processChildren = node => {
          if (typeof node === "string") {
            let processedNode = node;
            for (const [key, value] of window.rootStore.variableStore.values.entries()) {
              const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
              processedNode = processedNode.replaceAll(new RegExp(escapedKey, "g"), value);
            }
            return processedNode;
          } else if (Array.isArray(node)) {
            return node.map(processChildren);
          } else if (node && node.props && node.props.children) {
            return {
              ...node,
              props: {
                ...node.props,
                children: processChildren(node.props.children)
              }
            };
          }
          return node;
        };
        setProcessedChildren(processChildren(children));
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeGroup dropdown={dropdown}>{processedChildren}</CodeGroup>;
};

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****マスク済み*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

<Card title="始める前に">
  * アプリケーションで **MFA** grant type を有効にします。詳しくは、[Grant Types の更新](/ja/docs/get-started/applications/update-grant-types)を参照してください。
</Card>

Auth0 では、<Tooltip tip="多要素認証（MFA）: ユーザー名とパスワードに加え、SMS で送信されるコードなどの要素を使用するユーザー認証プロセス。" cta="用語集を見る" href="/ja/docs/glossary?term=multi-factor+authentication">多要素認証</Tooltip> (MFA) でアプリケーションに使用する認証要素を管理するための[API エンドポイント](https://auth0.com/docs/api/authentication#multi-factor-authentication)が複数用意されています。これらのエンドポイントを使用して、ユーザーが認証要素を管理できる完全なユーザーインターフェースを構築できます。

<div id="get-mfa-api-access-tokens">
  ## MFA API のアクセストークンを取得する
</div>

登録を管理するために MFA API を呼び出すには、まず MFA API 用の <Tooltip tip="アクセストークン: API へのアクセスに使用される、不透明な文字列または JWT 形式の認可資格情報。" cta="用語集を見る" href="/ja/docs/glossary?term=access+token">アクセストークン</Tooltip> を取得する必要があります。

認証フローの一部として MFA API を使用するには、[Authenticate With Resource Owner Password Grant and MFA](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa) に記載された手順に従ってください。認証要素を管理するユーザーインターフェースを構築する場合は、認証中に限らず、必要なときにいつでも MFA API で使用できるトークンを取得する必要があります。

MFA アクセストークン、または `https://{yourDomain}/mfa/` の <Tooltip tip="対象者: 発行されたトークンの対象者を一意に識別する値。トークン内では aud という名前で表され、その値には IDトークン の場合はアプリケーション（クライアントID）の ID、アクセストークン の場合は API（API Identifier）の ID が含まれます。" cta="用語集を見る" href="/ja/docs/glossary?term=audience">対象者</Tooltip> を持つアクセストークンは、認証に使用されると同時に、MFA の [チャレンジリクエスト](https://auth0.com/docs/api/authentication/muti-factor-authentication/request-mfa-challenge) を開始します。MFA チャレンジが開始されるかどうかは、テナントで有効になっている要素と、ユーザーの登録状況によって決まります。

* テナントで複数要素への登録が許可されており、ユーザーがワンタイムパスワード (OTP) などの有効な要素 (`email` を除く) に登録している場合、ログイン時に MFA チャレンジが実行されます。
* ユーザーがどの認証要素にも登録していない場合、または `email` 要素にのみ登録している場合は、MFA トークンは発行されますが、チャレンジは実行されません。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  `https://{yourDomain}/mfa/*` 対象者を持つアクセストークンのデフォルトの有効期限は 10 分です。この値は設定できません。
</Callout>

<div id="universal-login">
  ### Universal Login
</div>

[Universal Login](/ja/docs/authenticate/login/auth0-universal-login) を使用している場合は、`https://{yourDomain}/mfa/` を 対象者 として指定して、Authorize エンドポイントにリダイレクトします。

<Warning>
  `https://{yourDomain}/mfa/` を 対象者 として指定すると、MFA が強制されます。`.../mfa/` を 対象者 として指定している状態でエンドユーザーが **Remember this browser** を有効にしても、この設定は反映されません。

  Auth0 では、テナント管理者が `allowRememberBrowser` を false に設定する [Action を作成する](/ja/docs/customize/actions/write-your-first-action) ことを推奨しています。これにより、エンドユーザー向け画面で **Remember this browser** が表示されなくなります。
</Warning>

<div id="resource-owner-password-grant">
  ### リソースオーナー・パスワード・グラント
</div>

<Tooltip tip="リソースオーナー: 保護されたリソースへのアクセスを許可できるエンティティ（ユーザーやアプリケーションなど）。" cta="用語集を表示" href="/ja/docs/glossary?term=Resource+Owner">Resource Owner</Tooltip> Password Grant (ROPG) を使用している場合は、次の 3 つの方法があります。

* ログイン時に `https://{yourDomain}/mfa/` のオーディエンスを要求し、後で [リフレッシュトークン](/ja/docs/secure/tokens/refresh-tokens) を使用して更新します。
* 認証要素の一覧表示と削除が必要な場合は、`https://{yourDomain}/mfa/` のオーディエンスを指定して `/oauth/token` で再度 [認証](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa) するようユーザーに求めます。ユーザーは、認証要素の一覧表示や削除を行う前に MFA を完了する必要があります。
* 認証要素の一覧表示だけが必要な場合は、username/password を使用して `/oauth/token` で再度 [認証](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa) するようユーザーに求めます。このエンドポイントは `mfa_required` エラーと、認証要素の一覧表示に使用できる `mfa_token` を返します。ユーザーが自分の認証要素を表示するには、パスワードを入力する必要があります。

<div id="scopes">
  ### スコープ
</div>

MFA のオーディエンスに対するトークンをリクエストする場合は、次のスコープを要求できます。

| スコープ                    | 説明               |
| ----------------------- | ---------------- |
| `enroll`                | 新しい認証要素を登録します。   |
| `read:authenticators`   | 既存の認証要素を一覧表示します。 |
| `remove:authenticators` | 認証要素を削除します。      |

<div id="list-authenticators">
  ## 認証要素を一覧表示する
</div>

ユーザーの認証要素の一覧を取得するには、MFA Authenticators エンドポイントを呼び出します。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://{yourDomain}/mfa/authenticators' \
    --header 'authorization: Bearer MFA_TOKEN'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/mfa/authenticators");
  var request = new RestRequest(Method.GET);
  request.AddHeader("authorization", "Bearer MFA_TOKEN");
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/mfa/authenticators"

  	req, _ := http.NewRequest("GET", url, nil)

  	req.Header.Add("authorization", "Bearer MFA_TOKEN")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.get("https://{yourDomain}/mfa/authenticators")
    .header("authorization", "Bearer MFA_TOKEN")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'GET',
    url: 'https://{yourDomain}/mfa/authenticators',
    headers: {authorization: 'Bearer MFA_TOKEN'}
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/mfa/authenticators",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer MFA_TOKEN"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  headers = { 'authorization': "Bearer MFA_TOKEN" }

  conn.request("GET", "/{yourDomain}/mfa/authenticators", headers=headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/mfa/authenticators")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE

  request = Net::HTTP::Get.new(url)
  request["authorization"] = 'Bearer MFA_TOKEN'

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

レスポンスには、認証要素のタイプに関する情報が含まれます。

```json lines theme={null}
[
  {
    "authenticator_type": "recovery-code",
    "id": "recovery-code|dev_IsBj5j3H12VAdOIj",
    "active": true
  },
  {
    "authenticator_type": "otp",
    "id": "totp|dev_nELLU4PFUiTW6iWs",
    "active": true,
  },
  {
    "authenticator_type": "oob",
    "oob_channel": "sms",
    "id": "sms|dev_sEe99pcpN0xp0yOO",
    "name": "+1123XXXXX",
    "active": true
  }
]
```

エンドユーザーが自分の認証要素を管理するためのユーザーインターフェースを構築する場合は、`active` が `false` の 認証要素 は無視してください。これらの 認証要素 はユーザーによる確認が完了していないため、MFA のチャレンジには使用できません。

MFA API では、認証要素 の種類に応じて次の登録が一覧表示されます。

| Authenticator     | Actions                                                                                                                    |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Push and OTP**  | push が有効な場合、Auth0 は OTP の登録も作成します。登録を一覧表示すると、両方が表示されます。                                                                    |
| **SMS and Voice** | SMS と voice の両方が有効な場合、ユーザーが SMS または voice のいずれかで登録すると、Auth0 はその電話番号に対して 2 つの 認証要素 (1 つは SMS 用、もう 1 つは voice 用) を自動的に作成します。 |
| **Email**         | 確認済みのすべてのメールアドレスが 認証要素 として一覧表示されます。                                                                                        |

<div id="enroll-authenticators">
  ## 認証要素の登録
</div>

各要素の認証要素を登録する方法の詳細については、次のリンクを参照してください。

* [SMS または音声](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-challenge-sms-voice-authenticators)
* [ワンタイムパスワード (OTP) ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-otp-authenticators)
* [プッシュ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-push-authenticators)
* [メールアドレス](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-email-authenticators)

また、ユーザーをいつでも登録できるようにするには、[Universal Login フロー](/ja/docs/secure/multi-factor-authentication/multi-factor-authentication-developer-resources/create-custom-enrollment-tickets)を使用することもできます。

<div id="delete-authenticators">
  ## 認証要素を削除する
</div>

関連付けられた認証要素を削除するには、MFA Authenticators エンドポイントに `DELETE` リクエストを送信し、`AUTHENTICATOR_ID` を対象の認証要素の ID に置き換えます。ID は、認証要素を一覧表示した際に取得できます。

認証要素の一覧表示に `mfa_token` を使用した場合、認証要素を削除するには、対象者が `https://{yourDomain}/mfa/` のアクセストークンを取得するために、[MFA を完了](https://auth0.com/docs/api/authentication/muti-factor-authentication/verify-mfa-with-otp)する必要があります。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url 'https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID' \
    --header 'authorization: Bearer ACCESS_TOKEN'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID");
  var request = new RestRequest(Method.DELETE);
  request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID"

  	req, _ := http.NewRequest("DELETE", url, nil)

  	req.Header.Add("authorization", "Bearer ACCESS_TOKEN")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.delete("https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID")
    .header("authorization", "Bearer ACCESS_TOKEN")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'DELETE',
    url: 'https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID',
    headers: {authorization: 'Bearer ACCESS_TOKEN'}
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer ACCESS_TOKEN"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  headers = { 'authorization': "Bearer ACCESS_TOKEN" }

  conn.request("DELETE", "/{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID", headers=headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/mfa/authenticators/AUTHENTICATOR_ID")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE

  request = Net::HTTP::Delete.new(url)
  request["authorization"] = 'Bearer ACCESS_TOKEN'

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

認証要素が削除されると、204 レスポンスが返されます。

認証要素を削除すると、認証要素の種類に応じて次の動作が行われます。

| 認証要素              | アクション                                                                                          |
| ----------------- | ---------------------------------------------------------------------------------------------- |
| **Push and OTP**  | ユーザーがプッシュ認証要素を登録すると、Auth0 は OTP も登録します。どちらか一方を削除すると、もう一方も削除されます。                               |
| **SMS and Voice** | ユーザーが SMS または Voice のいずれかを登録すると、Auth0 は SMS と Voice の 2 つの認証要素を作成します。どちらか一方を削除すると、もう一方も削除されます。 |
| **Email**         | 確認済みのメールアドレスはすべて認証要素として一覧表示されますが、削除することはできません。削除できるのは、明示的に登録されたメールアドレス認証要素のみです。                |

<div id="regenerate-recovery-codes">
  ## 回復コードを再生成する
</div>

回復コードを削除して新しいコードを生成するには、Auth0 [Management API アクセストークン](https://auth0.com/docs/api/management/v2/tokens)を取得し、<Tooltip tip="Management API: 顧客が管理タスクを実行するための製品です。" cta="用語集を見る" href="/ja/docs/glossary?term=Management+API">Management API</Tooltip> の[回復コード再生成エンドポイント](https://auth0.com/docs/api/management/v2/#!/Users/post_recovery_code_regeneration)を使用します。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration' \
    --header 'authorization: Bearer MANAGEMENT_API_TOKEN'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration");
  var request = new RestRequest(Method.POST);
  request.AddHeader("authorization", "Bearer MANAGEMENT_API_TOKEN");
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration"

  	req, _ := http.NewRequest("POST", url, nil)

  	req.Header.Add("authorization", "Bearer MANAGEMENT_API_TOKEN")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.post("https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration")
    .header("authorization", "Bearer MANAGEMENT_API_TOKEN")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'POST',
    url: 'https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration',
    headers: {authorization: 'Bearer MANAGEMENT_API_TOKEN'}
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer MANAGEMENT_API_TOKEN"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  headers = { 'authorization': "Bearer MANAGEMENT_API_TOKEN" }

  conn.request("POST", "/{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration", headers=headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/api/v2/users/USER_ID/recovery-code-regeneration")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE

  request = Net::HTTP::Post.new(url)
  request["authorization"] = 'Bearer MANAGEMENT_API_TOKEN'

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

新しい回復コードが返されるため、エンドユーザーはそれを記録しておく必要があります。たとえば、次のようになります。

```json lines theme={null}
{  
   "recovery_code": "FA45S1Z87MYARX9RG6EVMAPE"
}
```

<div id="learn-more">
  ## 詳細情報
</div>

* [SMS および音声認証要素の登録とチャレンジ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-challenge-sms-voice-authenticators)
* [OTP 認証要素の登録とチャレンジ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-otp-authenticators)
* [Push 認証要素の登録とチャレンジ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-push-authenticators)
* [メールアドレス認証要素の登録とチャレンジ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-email-authenticators)
* [回復コードを使用したチャレンジ](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/challenge-with-recovery-codes)
