> ## 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 Dashboard と 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>;
};

<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/) に記載されている該当の無料トライアル条件に同意したものとみなされます。Auth0 の製品リリースサイクルの詳細については、[Product Release Stages](/docs/ja-jp/troubleshoot/product-lifecycle/product-release-stages) を参照してください。
</Warning>

各[組織](/docs/ja-jp/manage-users/organizations/organizations-overview)ごとに特定の接続を有効にして、ユーザーに異なるログインオプションを提供できます。接続を有効にすると、その接続が organization の ログインプロンプト に追加され、ユーザーはその接続を使用して認証し、アプリケーションにアクセスできるようになります。

組織で接続を有効にするには、その接続がすでにテナント内に存在している**必要があります**。サポート対象の接続には、[データベース接続](/docs/ja-jp/authenticate/database-connections)、[ソーシャル接続](/docs/ja-jp/authenticate/identity-providers/social-identity-providers)、および[エンタープライズ接続](/docs/ja-jp/authenticate/identity-providers/enterprise-identity-providers)があります。

<div id="organization-properties">
  ## 組織のプロパティ
</div>

組織を使用する場合、一部の接続では追加のプロパティを設定できます。

| **プロパティ**                   | **接続タイプ**    | **説明**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 組織の接続名                      | すべての接続タイプ    | この名前は、[My Organization API](/docs/ja-jp/manage-users/my-organization-api) を使用して Organization Admin が指定します。設定されていない場合は、この接続を表示する際に Organization Admin に表示したい名前を指定してください。                                                                                                                                                                                                                                                                                                                                                                                              |
| Organization Admin のアクセスレベル | すべての接続タイプ    | このプロパティは、この接続に対して Organization Admin が持つアクセスレベルを決定します。使用可能な値は次のとおりです。<ul><li>**None**: tenant Admin が管理し、My Organization API では表示も編集もできません。</li> <li>**Read-only**: tenant Admin が管理し、My Organization API で表示できます。</li> <li>**Limited**: Organization Admin は、My Organization API を使用して、選択された機密性の低い設定を編集できます。</li> <li>**Full**: Organization Admin は、[Connection Profile](/docs/ja-jp/authenticate/enterprise-connections/connection-profile) で定義された制限に従って、この接続で許可されているすべての設定を編集できます。</li></ul>                                                                     |
| 認証時のメンバーシップ                 | すべての接続タイプ    | 有効にすると、このプロパティにより、エンドユーザーがその接続で初めて認証した際に、自動的に組織のメンバーシップが割り当てられます。認証時のメンバーシップは、特定の接続で認証できるすべてのユーザーを、ある組織のメンバーとみなせるシナリオで役立ちます。                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 組織のサインアップ                   | データベース接続のみ   | このプロパティは、エンドユーザーがログインプロンプト上のサインアップリンクにアクセスして組織のメンバーシップを取得できるかどうかを決定します。組織のサインアップを使用するには、認証時のメンバーシップも有効にする必要があります。組織のサインアップは、ユーザーが 組織 に参加するためのセルフサービスアクセスを必要とするシナリオで役立ちます。たとえば、<ul><li>組織 を、ワークスペースのようなオープンメンバーシップのユーザー集団を表すために使用する場合。</li> <li>ユーザーが自由にアカウントへサインアップできる business-to-business-to-consumer (B2B2C) のユースケースの場合。</li></ul>                                                                                                                                                                                                                                |
| 接続をボタンとして表示                 | エンタープライズ接続のみ | 任意。このプロパティは、特定の接続を組織のログインプロンプト上の選択肢として表示するかどうかを決定します。エンドユーザーは、[Identifier First with Home Realm Discovery](/docs/ja-jp/authenticate/login/auth0-universal-login/identifier-first) 認証プロファイルを、[Prompt for Credentials](/docs/ja-jp/manage-users/organizations/login-flows-for-organizations#configure-the-login-flow-for-your-application) の組織ログインフローと組み合わせて使用し、認証することもできます。これは、認可リクエストで `org_id` を指定**しない**場合にのみ機能します。  <Callout icon="file-lines" color="#0EA5E9" iconType="regular"> このオプションが無効になっていても、エンドユーザーは認可リクエストで接続パラメータを直接送信することで、その接続を介して認証できます。 </Callout> |

<div id="configure-organization-connections">
  ## Organization Connections を設定する
</div>

組織の接続は、<Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品です。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip>または<Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品です。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip>のいずれかを使用して設定できます。

<Tabs>
  <Tab title="Auth0 Dashboard">
    #### Auth0 Dashboard

    Auth0 Dashboard で接続を有効にするには、次の手順に従います。

    1. [Auth0 Dashboard > Organizations](https://manage.auth0.com/#/organizations) に移動し、設定する organization を選択します。
    2. **Connections** タブを選択し、**Add Connections** を選択します。
    3. 有効にする接続を選択し、**Add Connection** を選択します。
    4. Organization Connection セクションで、My Organization API 経由で接続を利用するために必要な 2 つのプロパティを設定します。

    * **Organization Connection Name** を確認します。入力されていない場合は、この接続を表示したときに Organization Admins に表示する名前を指定します。
    * **Organization Admin Access Level** を確認し、入力されていない場合は、My Organization API 経由でこの接続に対して Organization Admins に付与するアクセスレベルを選択します。

    5. Authentication セクションで **Membership On Authentication** を確認し、自動メンバーシップを有効にするか無効にするかを選択します。有効にすると、この接続でログインするすべてのユーザーが自動的に organization のメンバーとして追加されます。
    6. **データベース接続のみ**: Organization Signup セクションで、セルフサービスのサインアップを有効にするか無効にするかを選択します。有効にすると、ユーザーはログイン画面のサインアップリンクからアカウントを作成し、自動的に organization のメンバーシップを取得できます。

       * このプロパティを有効にするには、まず **Membership on Authentication** を有効にする必要があります。
       * **注**: Organization Signup は、データベース接続のサインアップ設定より優先されます。Organization Signup が有効な場合、データベース接続レベルでサインアップが無効になっていても、ユーザーは引き続き organization へのサインアップや organization からの招待の承諾を行えます。
    7. **エンタープライズ接続のみ**: Connection button セクションで、必要に応じて **Display connection as a button** プロパティを有効にすると、organization のログイン画面に接続が選択肢として表示されます。

           <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
             organization 内で有効になっている接続がすべてエンタープライズ接続で、かつすべての接続が非表示になっている場合、ユーザーがアプリケーションにアクセスすると、Auth0 は `Message: no connections enabled for the organization are visible` というエラーを返します。
           </Callout>
    8. **Save** を選択します。
  </Tab>

  <Tab title="Management API">
    #### Management API

    Management APIを使用して接続を有効にするには:

    `Create Organization Connections` エンドポイントに `POST` リクエストを送信します。以下のプレースホルダーの値を適切な情報に置き換えてください：

    * `{orgId}` はご自身の組織IDに置き換えます。
    * `{mgmtApiAccessToken}` はご自身の Management APIアクセストークンに置き換えます。
    * `{connectionId}` は特定の接続IDに置き換えます。
    * `{assignMembershipOption}` は、認証時のメンバーシップの設定に応じて `true` または `false` に置き換えます。
    * `{isEnabled}` は、接続を有効にするかどうかに応じて `true` または `false` に置き換えます。
    * **データベース接続のみ**: `{isSignupEnabled}` は、サインアップ設定に応じて `true` または `false` に置き換えます。
    * **エンタープライズ接続のみ**: `{showAsButtonOption}` は、接続ボタンの設定に応じて `true` または `false` に置き換えます。
    * **My Organization API を使用する場合**: `{organizationAccessLevel}` と `{organizationConnectionName}` は適切な値に置き換えます。

    <AuthCodeGroup>
      ```bash cURL lines theme={null}
      curl --request POST \
        --url https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections \
        --header 'authorization: Bearer {yourMgmtApiAccessToken}' \
        --header 'cache-control: no-cache' \
        --header 'content-type: application/json' \
        --data '{ "connection_id": "{connectionId}", "assign_membership_on_login": "{assignMembershipOption}", "is_enabled": "{isEnabled}", "is_signup_enabled": "{isSignupEnabled}", "show_as_button": "{showAsButtonOption}", "organization_access_level": "{organizationAccessLevel}", "organization_connection_name": "{organizationConnectionName}"}'
      ```

      ```csharp C# lines theme={null}
      var client = new RestClient("https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections");
      var request = new RestRequest(Method.POST);
      request.AddHeader("content-type", "application/json");
      request.AddHeader("authorization", "Bearer {yourMgmtApiAccessToken}");
      request.AddHeader("cache-control", "no-cache");
      request.AddParameter("application/json", "{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }", ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      ```

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

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

      func main() {

      	url := "https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections"

      	payload := strings.NewReader("{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }")

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

      	req.Header.Add("content-type", "application/json")
      	req.Header.Add("authorization", "Bearer {yourMgmtApiAccessToken}")
      	req.Header.Add("cache-control", "no-cache")

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

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

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

      }
      ```

      ```java Java lines theme={null}
      HttpResponse<String> response = Unirest.post("https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections")
        .header("content-type", "application/json")
        .header("authorization", "Bearer {yourMgmtApiAccessToken}")
        .header("cache-control", "no-cache")
        .body("{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }")
        .asString();
      ```

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

      var options = {
        method: 'POST',
        url: 'https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections',
        headers: {
          'content-type': 'application/json',
          authorization: 'Bearer {yourMgmtApiAccessToken}',
          'cache-control': 'no-cache'
        },
        data: '{ "connection_id": "{connectionId}", "assign_membership_on_login": "{assignMembershipOption}", "is_enabled": "{isEnabled}", "is_signup_enabled": "{isSignupEnabled}", "show_as_button": "{showAsButtonOption}", "organization_access_level": "{organizationAccessLevel}", "organization_connection_name": "{organizationConnectionName}" }'
      };

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

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

      curl_setopt_array($curl, [
        CURLOPT_URL => "https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }",
        CURLOPT_HTTPHEADER => [
          "authorization: Bearer {yourMgmtApiAccessToken}",
          "cache-control: no-cache",
          "content-type: application/json"
        ],
      ]);

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

      curl_close($curl);

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

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

      conn = http.client.HTTPSConnection("")

      payload = "{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }"

      headers = {
          'content-type': "application/json",
          'authorization': "Bearer {yourMgmtApiAccessToken}",
          'cache-control': "no-cache"
          }

      conn.request("POST", "%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections", payload, headers)

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

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

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

      url = URI("https://%7ByourAuth0Domain%7D/api/v2/organizations/%7BorgId%7D/connections")

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

      request = Net::HTTP::Post.new(url)
      request["content-type"] = 'application/json'
      request["authorization"] = 'Bearer {yourMgmtApiAccessToken}'
      request["cache-control"] = 'no-cache'
      request.body = "{ \"connection_id\": \"{connectionId}\", \"assign_membership_on_login\": \"{assignMembershipOption}\", \"is_enabled\": \"{isEnabled}\", \"is_signup_enabled\": \"{isSignupEnabled}\", \"show_as_button\": \"{showAsButtonOption}\", \"organization_access_level\": \"{organizationAccessLevel}\", \"organization_connection_name\": \"{organizationConnectionName}\" }"

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

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

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

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

    | **値**                          | **説明**                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
    | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `{orgId}`                      | 接続を有効にする対象の組織のID。                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
    | `{mgmtApiAccessToken}`         | [Management API 用アクセストークン](/docs/ja-jp/secure/tokens/access-tokens/management-api-access-tokens) (スコープ `create:organization_connections` を含むもの) 。                                                                                                                                                                                                                                                                                                                    |
    | `{connectionId}`               | 指定した組織に対して有効にする接続のID。                                                                                                                                                                                                                                                                                                                                                                                                                                                |
    | `{assignMembershipOption}`     | この接続でログインするユーザーに、組織のメンバーシップを自動的に付与するかどうかを示します。`true` に設定すると、ユーザーにメンバーシップが自動的に付与されます。`false` に設定すると、メンバーシップは自動的に付与されません。                                                                                                                                                                                                                                                                                                                                              |
    | `{isEnabled}`                  | 組織の接続を有効または無効にします。接続を無効にすると、`show_as_button`、`assign_membership_on_login` などの値を保持したまま、接続を無効のままにしておくことができます。                                                                                                                                                                                                                                                                                                                                                          |
    | `{isSignupEnabled}`            | ユーザーがログインプロンプトでセルフサービスのサインアップリンクを利用できるかどうかを指定します。`true` に設定すると、サインアップリンクがプロンプトに表示されます。`false` に設定すると、リンクは表示されません。**注**: このオプションを有効にするには、`{assignMembershipOption}` も `true` に設定する必要があります。                                                                                                                                                                                                                                                                            |
    | `{showAsButtonOption}`         | 特定のエンタープライズ接続を組織のログインプロンプトで選択肢として表示するかどうかを示します。`true` に設定すると、その接続がプロンプトにボタンとして表示されます。`false` に設定すると、その接続はプロンプトに表示されません。                                                                                                                                                                                                                                                                                                                                              |
    | `{organizationAccessLevel}`    | My Organization API の使用時に、組織の Admin がどのレベルのアクセス権を持つかを決定します。`none` に設定すると、この接続は Tenant Admin によって管理され、My Organization API からは表示も編集もできません。`read-only` に設定すると、この接続は Tenant Admin によって管理され、My Organization API から表示はされますが、編集はできません。`limited` に設定すると、組織の Admin は My Organization API を通じて、選択された機密性の低い設定を編集できます。`full` に設定すると、組織の Admin は [Connection Profile](/docs/ja-jp/authenticate/enterprise-connections/connection-profile) で定義された制限に従って、この接続で許可されているすべての設定を編集できます。 |
    | `{organizationConnectionName}` | この名前は、My Organization API を介して組織の Admin によって提供されます。設定されていない場合は、この接続を表示する際に組織の Admin に表示したい名前を指定してください。                                                                                                                                                                                                                                                                                                                                                               |

    ##### レスポンスのステータスコード

    レスポンスのステータスコードは以下のとおりです：

    | **ステータスコード** | **エラーコード**           | **メッセージ**                                                                             | **原因**                                                        |
    | ------------ | -------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
    | `201`        |                      | 接続が組織に正常に追加されました。                                                                     |                                                               |
    | `401`        |                      | 無効なトークンです。                                                                            |                                                               |
    | `401`        |                      | JSON Web トークンのバリデーションで無効な署名が検出されました。                                                  |                                                               |
    | `401`        |                      | クライアントはグローバルではありません。                                                                  |                                                               |
    | `403`        | `insufficient_scope` | スコープが不足しています。次のいずれかが必要です: `create:organizations_connections`.                         | 指定された bearer token の scope では許可されていない field の読み取り/書き込みを試みました。 |
    | `429`        |                      | リクエストが多すぎます。X-RateLimit-Limit、X-RateLimit-Remaining、X-RateLimit-Reset のヘッダーを確認してください。 |                                                               |
  </Tab>
</Tabs>
