> ## 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 におけるファーストパーティアプリケーションとサードパーティアプリケーションの違いについて学びましょう。

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>;
};

Auth0 でアプリケーションを登録する際は、誰が所有し、運用しているかに基づいて、ファーストパーティかサードパーティかを判断します。

* **ファーストパーティアプリケーション** は、あなたの organization が所有し、運用するアプリケーションです。デプロイ、資格情報、動作はあなたが管理します。

* **サードパーティアプリケーション** は、パートナー、独立系開発者、または AI エージェントなどの外部 organization が所有し、運用するアプリケーションです。あなたはそれらに自分のリソースへのアクセスを許可しますが、そのアクセスで何を行うかを直接管理することはできません。

  "サードパーティ" が指すのは、作成者ではなく運用上の管理主体です。多くの組織では、自社アプリケーションの開発を外部に委託しています。たとえば、請負業者があなたのアプリケーションを開発していても、それだけでサードパーティになるわけではありません。重要な違いは、誰がそれをデプロイし、誰が資格情報を保持し、誰が停止できるかです。

ファーストパーティアプリケーションもサードパーティアプリケーションも、どちらも 機密アプリケーション (regular web apps) または Audience (SPA、ネイティブアプリ) になり得ます。

<div id="first-party-applications">
  ## ファーストパーティアプリケーション
</div>

ファーストパーティアプリケーションは、Auth0ドメインを所有するのと同じorganizationまたは個人によって管理されるアプリケーションです。たとえば、Contoso API と、`contoso.com` にログインして Contoso API を利用するアプリケーションを作成したとします。この場合、API とアプリケーションの両方を同じ Auth0ドメインに登録するため、そのアプリケーションはファーストパーティアプリケーションになります。デフォルトでは、[Auth0 Dashboard](https://manage.auth0.com/#/applications) から作成されたすべてのアプリケーションはファーストパーティアプリケーションです。

<div id="third-party-applications">
  ## サードパーティアプリケーション
</div>

サードパーティアプリケーションは、通常、あなたのAuth0 ドメインへの管理者アクセス権を持つべきではない第三者によって管理されます。サードパーティアプリケーションを利用すると、外部の当事者やパートナーが、API の背後にある保護されたリソースに安全にアクセスできるようになります。

たとえば、あるパートナー企業が、あなたのサービスの情報を可視化するデータ分析ダッシュボードを構築する場合、まずそのアプリケーションをお使いのAuth0 テナントに登録し、<Tooltip tip="Client ID: Auth0 から登録済みリソースに付与される識別値。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=client+ID">client ID</Tooltip>とシークレットを取得する必要があります。このアプリケーションはあなたの環境内に登録されていますが、コードと資格情報はあなたのorganizationではなくパートナーが所有・運用しているため、サードパーティと見なされます。

[Dynamic Client Registration](/docs/ja-jp/get-started/applications/dynamic-client-registration) を通じて作成されたすべてのアプリケーションは、サードパーティアプリケーションです。Auth0 におけるサードパーティアプリケーションの詳細については、[Third-Party Applications](/docs/ja-jp/get-started/applications/third-party-applications) を参照してください。

<div id="first-party-vs-third-party-in-auth0">
  ## Auth0 におけるファーストパーティとサードパーティ
</div>

次の表は、Auth0 におけるファーストパーティアプリケーションとサードパーティアプリケーションの違いをまとめたものです。

|                                 | **ファーストパーティ**            | **サードパーティ**                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **API アクセス**                    | API に設定されたアクセスポリシーに従う    | 常に明示的な [クライアントグラント](/docs/ja-jp/get-started/applications/application-access-to-apis-client-grants) が必要                                                                                                                                                                                                                                             |
| **Auth0 システム API**              | ユーザーフローで利用可能             | ユーザーフローでは利用不可                                                                                                                                                                                                                                                                                                                                      |
| **ユーザーの同意**                     | スキップ可能 (API で有効になっている場合) | 常に必要                                                                                                                                                                                                                                                                                                                                               |
| **グラントタイプ**                     | サポート対象のすべてのグラントタイプ       | `authorization_code`、`refresh_token`、`client_credentials`                                                                                                                                                                                                                                                                                          |
| **OIDC**                        | サポート対象                   | サポート対象外。今後のリリースで対応予定です。                                                                                                                                                                                                                                                                                                                            |
| **ルール**                         | 実行される                    | サポート対象外。エラーになります。                                                                                                                                                                                                                                                                                                                                  |
| **非 OAuth プロトコル** (SAML, WsFed) | サポート対象                   | サポート対象外                                                                                                                                                                                                                                                                                                                                            |
| **Organizations**               | サポート対象                   | サポート対象。ユーザーフローでは、organization で [サードパーティアプリケーションアクセスを許可](/docs/ja-jp/manage-users/organizations/configure-organizations/enable-third-party-application-access) する必要があります。[Machine-to-Machine (M2M) Access for Organizations](/docs/ja-jp/manage-users/organizations/organizations-for-m2m-applications) を介した `client_credentials` アクセスがサポートされています。 |
| **Client ID の形式**               | 標準形式                     | `tpc_` プレフィックス                                                                                                                                                                                                                                                                                                                                     |
| **接続**                          | 有効になっているすべての接続           | ドメインレベルの接続                                                                                                                                                                                                                                                                                                                                         |

Auth0 のサードパーティアプリケーションの詳細については、[Third-Party Applications](/docs/ja-jp/get-started/applications/third-party-applications) を参照してください。

<div id="application-ownership">
  ## アプリケーションの所有区分
</div>

アプリケーションの所有区分は作成時に決まり、その後は変更できません。デフォルトでは、アプリケーションはファーストパーティとして作成され、より制限の少ないセキュリティ設定が適用されます。適切な[セキュリティ制御](/docs/ja-jp/get-started/applications/third-party-applications/security-controls)を適用するには、外部の関係者が所有するアプリケーションを、Auth0 Dashboard または Management API で作成する際に、サードパーティとして正しく指定する必要があります。詳しくは、[サードパーティアプリケーションの設定](/docs/ja-jp/get-started/applications/third-party-applications/configure-third-party-applications)を参照してください。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  アプリケーションの所有区分は変更できません。サードパーティアプリケーションをファーストパーティに変更することも、その逆に変更することもできません。
</Callout>

<div id="check-application-ownership">
  ## アプリケーションの所有区分を確認する
</div>

アプリケーションがファーストパーティとサードパーティのどちらかを確認するには：

<Tabs>
  <Tab title="Auth0 Dashboard">
    1. **アプリケーション > アプリケーション** に移動します。
    2. アプリケーションを選択します。サードパーティアプリケーションには、サードパーティであることを示すバッジが表示されます。

    <Frame>
      <img src="https://mintcdn.com/translations/S4csL9vq6QUX5-Rr/docs/images/third-party-applications/third-party-badge.png?fit=max&auto=format&n=S4csL9vq6QUX5-Rr&q=85&s=682354244f06a1fdeeb5cea2036e2cde" alt="サードパーティバッジが表示された Auth0 Dashboard のアプリケーション設定" width="433" height="67" data-path="docs/images/third-party-applications/third-party-badge.png" />
    </Frame>
  </Tab>

  <Tab title="Management API">
    [Get a Client エンドポイント](https://auth0.com/docs/api/management/v2#!/Clients/get_clients_by_id)に `GET` リクエストを送信します。`{YOUR_CLIENT_ID}`
    および `{YOUR_MANAGEMENT_API_ACCESS_TOKEN}` のプレースホルダー値を、それぞれ<Tooltip tip="Client ID: Auth0 から登録済みリソースに付与される識別値。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=client+ID">クライアント ID</Tooltip> と Management API の<Tooltip tip="アクセストークン: API にアクセスするために使用される認可資格情報。不透明な文字列または JWT の形式で提供されます。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Access+Token">アクセストークン</Tooltip>に置き換えてください。

    <AuthCodeGroup>
      ```bash cURL theme={null}
      curl --request GET \
        --url 'https://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true' \
        --header 'authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}'
      ```

      ```csharp C# theme={null}
      var client = new RestClient("https://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true");
      var request = new RestRequest(Method.GET);
      request.AddHeader("authorization", "Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}");
      IRestResponse response = client.Execute(request);
      ```

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

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

      func main() {

      	url := "https://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true"

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

      	req.Header.Add("authorization", "Bearer {YOUR_MANAGEMENT_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 response = Unirest.get("https://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true")
        .header("authorization", "Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}")
        .asString();
      ```

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

      var options = {
        method: 'GET',
        url: 'https://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}',
        params: {fields: 'is_first_party', include_fields: 'true'},
        headers: {authorization: 'Bearer {YOUR_MANAGEMENT_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://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true",
        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 {YOUR_MANAGEMENT_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 {YOUR_MANAGEMENT_API_ACCESS_TOKEN}" }

      conn.request("GET", "/{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true", 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://{YOUR_DOMAIN}/api/v2/clients/{YOUR_CLIENT_ID}?fields=is_first_party&include_fields=true")

      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 {YOUR_MANAGEMENT_API_ACCESS_TOKEN}'

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

    | 値                                  | 説明                                                                                                                                     |
    | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
    | `YOUR_CLIENT_ID`                   | 更新対象のアプリケーションのID。                                                                                                                      |
    | `YOUR_MANAGEMENT_API_ACCESS_TOKEN` | [Management API のアクセストークン](https://auth0.com/docs/api/management/v2/tokens) ([スコープ](/docs/ja-jp/glossary?term=scope) `read:clients`) 。 |

    アプリケーションがファーストパーティの場合、`is_first_party` フィールドの値は `true` になります。アプリケーションがサードパーティの場合、`is_first_party` フィールドの値は `false` になります。
  </Tab>
</Tabs>

<div id="learn-more">
  ## 詳細はこちら
</div>

* [サードパーティアプリケーション](/docs/ja-jp/get-started/applications/third-party-applications)
* [サードパーティアプリケーション向けのセキュリティ制御](/docs/ja-jp/get-started/applications/third-party-applications/security-controls)
* [機密アプリケーションとパブリックアプリケーション](/docs/ja-jp/get-started/applications/confidential-and-public-applications)
* [ユーザーの同意とサードパーティアプリケーション](/docs/ja-jp/get-started/applications/third-party-applications/user-consent-and-third-party-applications)
