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

# 接続をテストする

> 接続をテストする方法について説明します。

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) + "*****MASKED*****";
          }
          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>;
};

export const codeExample = `https://{yourDomain}/authorize?response_type=token&scope=openid%20profile&client_id={yourClientId}&redirect_uri=http%3A%2F%2Fjwt.io&connection={connectionToTest}`;

一般的に、接続をテストするには、<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=auth0-dashboard" tip="Auth0 Dashboard: サービスを構成するためのAuth0の主製品。" cta="用語集の表示">Auth0 Dashboard</Tooltip>にログインする必要があります。

1. [Auth0 Dashboard](https://manage.auth0.com/#)で\*\*［Authentication（認証）］\*\* を選択し、テストしたい接続の種類を選択します。
2. テストしたい接続を見つけて、**［More Options（その他のオプション）］** メニュー（\*\* ［...］\*\*）から **［Try Connection（接続を試す）］** を選択します。
3. IDプロバイダーでログインします。
4. 結果として **［It Works!（動作します！）］** ページが表示されるのを待ちます。

Auth0はアプリケーションだと想定して認証フローのシミュレーションを行い、認証が成功した結果のユーザープロファイルを表示します。

## パートナーの接続をテストする

他の誰かに属する接続をテストしていて、テストの資格情報がない場合は、Auth0 Dashboardにログインできません。これは、<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-1" href="/docs/ja-jp/glossary?term=security-assertion-markup-language" tip="Security Assertion Markup Language（SAML）: パスワードなしに二者間で認証情報を交換できる標準化プロトコル。" cta="用語集の表示">SAML</Tooltip> IDプロバイダー（<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-2" href="/docs/ja-jp/glossary?term=idp" tip="IDプロバイダー（IdP）: デジタルIDを保存および管理するサービス。" cta="用語集の表示">IdP</Tooltip>）やActive Directoryなど、エンタープライズ接続への接続ではよくあることです。解決策パートナーは新しい接続をテストすることができます。

1. テストアプリを登録します。

   * [［Auth0 Dashboard］>［Applications（アプリケーション）］>［Applications（アプリケーション）］](https://manage.auth0.com/#/applications)に移動して、**［Create Application（アプリケーションの作成）］** を選択します。任意の名前（`Test App`など）を付けます。
   * 新しく作成したアプリの設定で、**［Allowed Callback URLs（許可されているCallback URL）］** を`http://jwt.io`に設定します。
   * **［Save Changes（変更の保存）］** を選択します。
2. APIを登録します。

   * [［Auth0 Dashboard］>［Applications（アプリケーション）］>［API］](http://https://manage.auth0.com/#/api)に移動します。**［Create API（APIの作成）］** を選択します。
   * アクセストークンの作成では、オーディエンスを指定することをお勧めします。
   * オーディエンスを指定しないと、アクセストークンが不透明な[JWEトークン](https://datatracker.ietf.org/doc/html/rfc7516#section-3.3)となり、[Auth0のAuthentication API](https://auth0.com/docs/api/authentication)だけしかそれを認識できなくなります。
3. ログインのリンクをパートナーに送信します。

   <AuthCodeBlock children={codeExample} language="text" lines />

   以下の2つのパラメーターを置き換えます。

   * `client_id`：手順1で作成したアプリケーションのクライアントIDです。
   * `connection`：テストしたい接続の名前です。
4. 接続をテストします。パートナーがリンクを使用すると、パートナー自身に構成済みのIDプロバイダー（接続）にリダイレクトされます。認証が成功すると、[JWT.io](http://jwt.io)に戻され、すべてのユーザープロパティがトークンからデコードされます。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  テストアプリは実際のアプリではありません。[JWT.io](http://jwt.io)は、URLフラグメントで送信されたトークンをデコードするテスト用Webサイトです。
</Callout>
