> ## 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 Management API を使用して Organization Connections を取得する方法について説明します。

# Organization Connections を取得する

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

<Warning>
  新しいエンドポイントと属性を使用した Organization Connections の管理機能は、[My Organization API and Embeddable UI Components](/docs/ja-jp/manage-users/my-organization-api) の一部として早期アクセスで提供されています。この機能を使用すると、[Okta’s Master Subscription Agreement](https://www.okta.com/legal/) に記載されている該当する Free Trial 条項に同意したものとみなされます。Auth0 の製品リリースサイクルの詳細については、[Product Release Stages](/docs/ja-jp/troubleshoot/product-lifecycle/product-release-stages) をご覧ください。
</Warning>

[Auth0 Organizations](/docs/ja-jp/manage-users/organizations/organizations-overview) をプログラムで扱う場合、組織の接続一覧を取得する必要があることがあります。

組織に関連付けられた接続は、<Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> または <Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip> のいずれかで確認できます。

<div id="auth0-dashboard">
  ## Auth0 Dashboard
</div>

1. [Auth0 Dashboard > Organizations](https://manage.auth0.com/#/organizations) に移動し、組織 を選択します。
2. **接続**ビューを選択します。

<div id="management-api">
  ## Management API
</div>

`Get Organization Connections` エンドポイントに対して `GET` リクエストを実行します。`ORG_ID` と `MGMT_API_ACCESS_TOKEN` のプレースホルダー値は、それぞれご利用の組織ID と Management API の <Tooltip tip="アクセストークン: API へのアクセスに使用される、opaque な文字列または JWT 形式の Authorization 資格情報。" cta="用語集を表示" href="/docs/ja-jp/glossary?term=Access+Token">アクセストークン</Tooltip> に必ず置き換えてください。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://{yourDomain}/api/v2/organizations/ORG_ID/connections' \
    --header 'authorization: Bearer MGMT_API_ACCESS_TOKEN'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/organizations/ORG_ID/connections");
  var request = new RestRequest(Method.GET);
  request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_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/organizations/ORG_ID/connections"

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

  	req.Header.Add("authorization", "Bearer MGMT_API_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.get("https://{yourDomain}/api/v2/organizations/ORG_ID/connections")
    .header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
    .asString();
  ```

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

  var options = {
    method: 'GET',
    url: 'https://{yourDomain}/api/v2/organizations/ORG_ID/connections',
    headers: {authorization: 'Bearer MGMT_API_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}/api/v2/organizations/ORG_ID/connections",
    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 MGMT_API_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 MGMT_API_ACCESS_TOKEN" }

  conn.request("GET", "/{yourDomain}/api/v2/organizations/ORG_ID/connections", 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/organizations/ORG_ID/connections")

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

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

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

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  **Auth0ドメインを確認する**

  Auth0ドメインは、tenant 名、リージョンのサブドメイン (tenant が US リージョンにあり、2020 年 6 月より前に作成されている場合を除く) 、および `.auth0.com` を組み合わせたものです。たとえば、tenant 名が `travel0` の場合、Auth0ドメイン名は `travel0.us.auth0.com` になります。 (tenant が US にあり、2020 年 6 月より前に作成されている場合、ドメイン名は `https://travel0.auth0.com` になります。)

  [custom domains](/docs/ja-jp/customize/custom-domains) を使用している場合は、ここにそのカスタムドメイン名を指定してください。
</Callout>

| 値                       | 説明                                                                                                                                          |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `ORG_ID`                | 接続を取得する組織の ID。                                                                                                                              |
| `MGMT_API_ACCESS_TOKEN` | スコープ `read:organization_connections` を持つ [Management API 用のアクセストークン](/docs/ja-jp/secure/tokens/access-tokens/management-api-access-tokens)。 |

<div id="response-status-codes">
  ### レスポンスステータスコード
</div>

想定されるレスポンスステータスコードは次のとおりです。

| ステータスコード | エラーコード               | メッセージ                                                                                | 原因                                                    |
| -------- | -------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------- |
| `200`    |                      | 接続の取得に成功しました。                                                                        |                                                       |
| `400`    | `invalid_body`       | 無効なリクエストボディです。メッセージは原因によって異なります。                                                     | リクエストのペイロードが無効です。                                     |
| `401`    |                      | 無効なトークンです。                                                                           |                                                       |
| `401`    |                      | JSON Web トークンのバリデーションで受信した署名が無効です。                                                   |                                                       |
| `401`    |                      | クライアントはグローバルではありません。                                                                 |                                                       |
| `403`    | `insufficient_scope` | スコープが不足しています。必要なスコープ: `read:organization_connections` のいずれか。                         | 提供されたベアラートークンのスコープでは許可されていないフィールドの読み取りまたは書き込みを試行しました。 |
| `429`    |                      | リクエストが多すぎます。X-RateLimit-Limit、X-RateLimit-Remaining、X-RateLimit-Reset ヘッダーを確認してください。 |                                                       |
