> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 動的クライアント登録

> Auth0 でサードパーティアプリケーションを動的に登録する方法を説明します。

テナント向けにサードパーティアプリケーションを動的に登録できます。Dynamic Client Registration (DCR) は、[OpenID Connect Dynamic Client Registration specification](https://openid.net/specs/openid-connect-registration-1_0.html) に基づいています。

Dynamic Client Registration で作成されたすべてのアプリケーションは、[サードパーティアプリケーション](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications)として扱われ、[強化されたセキュリティ制御](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications/security-controls.md)が適用されます。つまり、DCR クライアントには次の制限があります。

* クライアント ID に `tpc_` プレフィックスが付与される
* 認可コードフローでは PKCE が必須
* サポートされるグラントタイプは `authorization_code` と `refresh_token` のみ。`client_credentials` グラントタイプは DCR では利用できません。
* API へのアクセスは、明示的な[クライアントグラント](https://auth0.com/docs/ja-jp/get-started/applications/application-access-to-apis-client-grants.md)を通じてのみ可能
* 認証には[ドメインレベルの接続](https://auth0.com/docs/ja-jp/authenticate/identity-providers/promote-connections-to-domain-level.md)のみ使用可能

## Dynamic Client Registration を有効にする

> [!WARNING]
>
> Auth0 は Open Dynamic Registration をサポートしています。これを有効にすると、トークンなしで誰でもあなたのテナントにアプリケーションを作成できるようになります。

デフォルトでは、Dynamic Client Registration はすべてのテナントで無効になっています。Dynamic Client Registration を有効にするには、Auth0 Dashboard または Management API を使用します。

> [tab] Auth0 Dashboard
>
> 1. [Auth0 Dashboard > 設定 > Advanced](https://manage.auth0.com/#/tenant/advanced) に移動し、**Dynamic Client Registration (DCR)** を有効にします。

> [tab] Management API
>
> [`/api/v2/tenants/settings`](https://auth0.com/docs/ja-jp/api/management/v2/tenants/patch-settings) エンドポイントを使用して、テナント設定の `enable_dynamic_client_registration` フラグを `true` に設定します。
>
> Auth0 CLI を使用していますか？まだセットアップしていない場合は、このコマンドを実行する前に[CLI セッションをセットアップして認証](https://auth0.com/docs/ja-jp/deploy-monitor/auth0-cli.md)してください。
>
> `{YOUR_MANAGEMENT_API_TOKEN}` は、`update:tenant_settings` スコープを持つ有効なトークンに置き換える必要があります。詳しくは、[Management API アクセストークン](https://auth0.com/docs/ja-jp/secure/tokens/access-tokens/management-api-access-tokens.md) を参照してください。

## DCR クライアントの API アクセスを設定する

DCR を有効にする前に、動的に登録されるクライアントがアクセスする API で、[サードパーティアプリケーションのデフォルト権限](https://auth0.com/docs/ja-jp/get-started/applications/application-access-to-apis-client-grants.md#default-permissions-for-third-party-applications)を設定してください。デフォルト権限がないと、DCR クライアントはどの API にもアクセスできません。

デフォルト権限では、すべてのサードパーティアプリケーションが自動的に利用できる API とスコープの基本セットを定義します。DCR では登録フロー中にアプリケーションごとのクライアントグラントを設定できないため、これは不可欠です。

デフォルト権限の設定方法については、[サードパーティアプリケーションを設定する](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications/configure-third-party-applications.md#default-permissions-for-all-third-party-applications)を参照してください。

## アプリケーションを登録する

アプリケーションを動的に登録するには、`/oidc/register` エンドポイントに `POST` リクエストを送信します。Auth0 は Open Dynamic Registration をサポートしているため、`/oidc/register` エンドポイントはアクセストークンなしでも登録リクエストを受け付けます。

| **パラメーター** | **説明** |
| - | - |
| `client_name` | 作成するアプリケーションの名前です。 |
| `redirect_uris` (required) | 認証フローの最後に、Auth0 が有効なコールバック URL として受け入れる URL の配列です。 |
| `token_endpoint_auth_method` | トークンエンドポイントの認証方法です。パブリッククライアント (SPA、Native) の場合は `none`、機密クライアントの場合は `client_secret_post` (デフォルト) を使用します。 |
| `grant_types` | アプリケーションで使用するグラントタイプです。レスポンスでは、使用が許可されているものだけが返されるように絞り込まれます。DCR を通じて作成されたアプリケーションでは、`authorization_code` と `refresh_token` をサポートします。 |
| `response_types` | アプリケーションで使用するレスポンスタイプです。認可コードフローでは `code` を使用します。 |

成功すると、Auth0 はアプリケーションの資格情報を返します。

```json theme={null}
{
  "client_name": "My Dynamic Application",
  "client_id": "tpc_8SXWY6j3afl2CP5ntwEOpMdPxxy49Gt2",
  "client_secret": "Q5O...33P",
  "redirect_uris": [
    "https://application.example.com/callback"
  ],
  "client_secret_expires_at": 0,
  "grant_types": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_method": "none"
}
```

| **フィールド** | **説明** |
| - | - |
| `client_id` | `tpc_` プレフィックスが付いた一意のアプリケーション識別子です。認証フローを開始するときに使用します。 |
| `client_secret` | 機密クライアント用のアプリケーションシークレットです。`token_endpoint_auth_method` が `none` の場合は返されません。 |
| `client_secret_expires_at` | クライアントシークレットの有効期限です。Auth0 では常に `0` (期限なし) です。 |

サードパーティの開発者は、登録後にアプリケーション設定を変更できません。変更が必要な場合は、テナントの所有者に連絡する必要があります。

登録後、アプリケーションは `client_id` と設定された `redirect_uris` を使用して、[PKCE を使用した Authorization Code フロー](https://auth0.com/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce.md) を開始できます。

## テナントアクセス制御リスト (ACL)

Auth0 では、`/oidc/register` エンドポイントへのトラフィックを管理するための [テナントアクセス制御リスト (ACL)](https://auth0.com/docs/ja-jp/secure/tenant-access-control-list) を提供しています。次の条件に基づいて ACL ルールを設定することで、DCR リクエストを送信できる相手を制限できます。

* 送信元 IP アドレスと CIDR 範囲
* 地理的位置
* その他のリクエストシグナル

DCR の ACL ルールを設定するには、ACL ルールに `dynamic_client_registration` スコープを追加します。詳しくは、[テナント ACL Reference](https://auth0.com/docs/ja-jp/secure/tenant-access-control-list/reference.md) をご覧ください。

## レート制限

`/oidc/register` エンドポイントには、テナントごとに 1 秒あたり 5 リクエストのレート制限が適用されます。レート制限の詳細については、[レート制限の設定](https://auth0.com/docs/ja-jp/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations)をご覧ください。

## DCR の許容モード

2026年4月以前からサードパーティアプリケーションを使用している一部のお客様は、強化されたセキュリティ制御ではなく、従来の動作を備えたアプリケーションを作成するように DCR を設定できます。詳しくは、[許容モードでの Dynamic Client Registration](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications/permissive-mode.md#dynamic-client-registration-in-permissive-mode) をご覧ください。

## さらに詳しく

* [サードパーティアプリケーション](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications)
* [サードパーティアプリケーション向けのセキュリティ制御](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications/security-controls.md)
* [API へのアプリケーションアクセス: クライアントグラント](https://auth0.com/docs/ja-jp/get-started/applications/application-access-to-apis-client-grants.md)
* [ファーストパーティアプリケーションとサードパーティアプリケーション](https://auth0.com/docs/ja-jp/get-started/applications/first-party-and-third-party-applications.md)
* [ユーザーの同意とサードパーティアプリケーション](https://auth0.com/docs/ja-jp/get-started/applications/third-party-applications/user-consent-and-third-party-applications.md)
