> ## 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）を利用する方法を学びます。

# カスタムトークン交換での多要素認証（MFA）

export const ReleaseStageNotice = ({feature, stage, plans, contact, terms}) => {
  const stageTextMap = {
    "beta": "Beta",
    "ea": "早期アクセス"
  };
  const stageText = stageTextMap[stage] || "製品リリース段階";
  const prsLink = "/docs/troubleshoot/product-lifecycle/product-release-stages";
  const linkify = (text, url) => {
    return <a href={url} target="_blank" rel="noreferrer" class="link">{text}</a>;
  };
  const includeDetails = (plans, contact, terms) => {
    const hasDetails = terms || plans || contact;
    if (!hasDetails) return null;
    return <span data-as="p">
            {plans && <>この機能は{linkify(`${plans}プラン`, "https://auth0.com/pricing")}でご利用いただけます。 </>}
            {contact && "参加をご希望の場合は、" + contact + "までお問い合わせください。 "}
            {terms && <>この機能を使用することにより、Oktaの該当する無料トライアル規約および{linkify("Master Subscription Agreement", "https://www.okta.com/legal")}に同意したものとみなされます。</>}
        </span>;
  };
  return <Warning>
            <span data-as="p">
                <strong>{feature}機能は現在、{linkify(stageText, prsLink)}です。</strong>
            </span>

            {includeDetails(plans, contact, terms)}
        </Warning>;
};

<ReleaseStageNotice feature="カスタムトークン交換 (CTE)" stage="ea" plans="B2C Professional, B2B Professional, and Enterprise" terms="true" />

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  `api.authentication.setActor()` で actor が設定されるカスタムトークン交換のトランザクションでは、MFA は使用できません。MFA が必要な場合 (ポリシーまたは Post-Login Action による) に、カスタムトークン交換 Action で actor を設定すると、トランザクションは `400` エラー `MFA is not supported using actor_token with the requested token exchange profile.` で失敗します。
</Callout>

トークンの盗難やその他のセキュリティリスクへの対策として、次のいずれかの方法でカスタムトークン交換リクエストに多要素認証を追加できます。

* テナントで [MFA ポリシーを有効にして設定する](/docs/ja-jp/secure/multi-factor-authentication/enable-mfa)
* Post-Login Action で `api.multifactor.enable()` を使用する

MFA を追加すると、Auth0認可サーバーは最初のカスタムトークン交換の `/token` エンドポイントへの呼び出しを、`mfa_required` エラーで拒否します。要求された Auth0 のアクセストークン、ID トークン、リフレッシュトークンを取得するには、このエラーを [Auth0 MFA API](/docs/ja-jp/secure/multi-factor-authentication/multi-factor-authentication-developer-resources/mfa-api) で使用し、認証要素に対する challenge と検証を行えます。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  カスタムトークン交換では、`api.authentication.challengeWith()` と `api.authentication.enrollWith()` はサポートされていません。これらのメソッドを Post-Login Action で使用すると、トランザクションは回復不能なエラーで失敗します。`subject_token_type` の値に応じて、`event.transaction.protocol==oauth2-token-exchange` の場合はこれらのメソッドを使用しないようにしてください。
</Callout>

カスタムトークン交換のトランザクションが組織に関連付けられている場合、`api.multifactor.enable()` と MFA ポリシーもサポートされません。

MFA グラントの使い方について詳しくは、カスタムトークン交換も同じモデルに従うため、[MFA を使用してリソース所有者パスワードフローで認証する](/docs/ja-jp/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa) を参照してください。詳しい例については、[ユースケース: カスタムトークン交換中に MFA を実行する](/docs/ja-jp/authenticate/custom-token-exchange/cte-example-use-cases#use-case%3A-perform-mfa-during-custom-token-exchange) もご覧ください。
