> ## 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 がサポートする OAuth 2.0 グラントタイプと、認証フローに合わせて設定する方法を説明します。

# アプリケーションのグラントタイプ

アプリケーションのグラントタイプ (またはフロー) とは、アプリケーションが[アクセストークン](/docs/ja-jp/secure/tokens/access-tokens)を取得するための方式です。また、資格情報を公開することなく、別のエンティティにリソースへの限定的なアクセスを付与する方法でもあります。[OAuth 2.0 プロトコル](/docs/ja-jp/get-started/authentication-and-authorization-flow/which-oauth-2-0-flow-should-i-use)は複数のグラントタイプをサポートしており、それぞれ異なる種類のアクセスを可能にします。

アプリケーションの要件によっては、他より適したグラントタイプがあります。Auth0 では、さまざまな認証および<Tooltip tip="Authorization Flow: OAuth 2.0 フレームワークで指定された認可グラント（またはワークフロー）。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=authorization+flows">認可フロー</Tooltip>を提供しており、アプリケーションの `grant_types` プロパティに基づいて、どのグラントタイプを使用できるかを指定できます。

たとえば、モバイルアプリケーションを保護したい場合は、[Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce)が最も適しています。

一方、シングルページアプリケーション (SPA) のようなクライアントサイドのアプリケーションを保護したい場合で、サーバー間でトークンをやり取りしないのであれば、[Implicit Flow with Form Post](/docs/ja-jp/get-started/authentication-and-authorization-flow/implicit-flow-with-form-post)が最も適しています。

アプリケーションの登録時に使用できるグラントタイプは複数あります。これらは次のカテゴリに分けられます。

* **仕様準拠のグラント**: <Tooltip tip="OpenID: アプリケーションがログイン情報を収集・保存することなく、ユーザーの本人確認を行えるようにする認証のオープン標準。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=OpenID">OpenID</Tooltip> Connect (OIDC) など、外部仕様で定義され、その仕様に準拠したグラント。
* **Auth0 拡張グラント**: 追加のクライアントをサポートしたり、<Tooltip tip="OAuth 2.0: 認可プロトコルとワークフローを定義する認可フレームワーク。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=OAuth">OAuth</Tooltip> と他の信頼フレームワークの橋渡しをしたりするために、[OAuth extension mechanism](https://tools.ietf.org/html/rfc6749#section-4.5) に準拠した Auth0 固有のグラント。
* **Auth0 レガシーグラント**: レガシー顧客のみを対象としてサポートされる従来のグラントタイプです。レガシー顧客の場合は、より安全な代替手段に移行することを強くお勧めします。

<div id="available-grant-types">
  ## 利用できるグラントタイプ
</div>

<div id="specification-conforming-grants">
  ### 仕様準拠のグラント
</div>

| グラントタイプ                                        | 説明                                                                                                             |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `implicit`                                     | [Implicit Grant](/docs/ja-jp/get-started/authentication-and-authorization-flow/implicit-flow-with-form-post)   |
| `authorization_code`                           | [認可コードグラント](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow)             |
| `client_credentials`                           | [クライアントクレデンシャルグラント](/docs/ja-jp/get-started/authentication-and-authorization-flow/client-credentials-flow)     |
| `password`                                     | [リソース所有者パスワードグラント](/docs/ja-jp/get-started/authentication-and-authorization-flow/resource-owner-password-flow) |
| `refresh_token`                                | [リフレッシュトークンを使用する](/docs/ja-jp/secure/tokens/refresh-tokens/use-refresh-tokens)                                 |
| `urn:ietf:params:oauth:grant-type:device_code` | [デバイス認可グラント](/docs/ja-jp/get-started/authentication-and-authorization-flow/device-authorization-flow)          |

<div id="auth0-extension-grants">
  ### Auth0 拡張グラント
</div>

| **グラントタイプ**                                               | **説明**                                         |
| --------------------------------------------------------- | ---------------------------------------------- |
| **`http://auth0.com/oauth/grant-type/password-realm`**    | 特定のレルムを指定できる、リソース所有者パスワードグラントに類似した拡張グラントを使用します |
| **`http://auth0.com/oauth/grant-type/mfa-oob`**           | 多要素認証のアウトオブバンド グラントリクエスト                       |
| **`http://auth0.com/oauth/grant-type/mfa-otp`**           | 多要素認証 OTP グラントリクエスト                            |
| **`http://auth0.com/oauth/grant-type/mfa-recovery-code`** | 多要素認証リカバリーコードのグラントリクエスト                        |
| **`http://auth0.com/oauth/grant-type/passwordless/otp`**  | 埋め込み型パスワードレスログインのグラントリクエスト                     |

<div id="auth0-legacy-grants">
  ### Auth0 レガシーグラント
</div>

レガシーグラントには次のものがあります。

* `http://auth0.com/oauth/legacy/grant-type/ro`
* `http://auth0.com/oauth/legacy/grant-type/ro/jwt-bearer`
* `http://auth0.com/oauth/legacy/grant-type/delegation/refresh_token`
* `http://auth0.com/oauth/legacy/grant-type/delegation/id_token`
* `http://auth0.com/oauth/legacy/grant-type/access_token`

レガシーグラントタイプは、従来のお客様専用にサポートされている従来型のグラントタイプです。該当するお客様は、より安全な代替手段へ移行することを強くお勧めします。

2017 年 6 月 8 日以降、すべてのアプリケーションに、設定が必須の `grant_types` プロパティが追加されました。当時の Auth0 のお客様に機能上の変更が生じないよう、既存のすべてのアプリケーションの `grant_types` プロパティには、Auth0 レガシー、Auth0 extension、および仕様準拠のすべてのグラントタイプが設定されました。

この時点で、新規の Auth0 のお客様は、自身のアプリケーションにレガシーグラントタイプを追加できなくなりました。レガシーグラントタイプは、互換性のない変更を避けながら新しいフローへ移行できるよう、以前からのお客様にのみ提供されています。2017 年 6 月 8 日より前からご利用のお客様は、<Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> または Auth0 <Tooltip tip="Management API: テナント、アプリケーション、ユーザー、その他のリソースをプログラムで管理するための Auth0 の管理 API。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip> のいずれかを使用して、[レガシーグラントタイプを有効化](/docs/ja-jp/get-started/applications/update-grant-types) できます。

現在レガシーグラントタイプを使用している場合は、代わりに使用すべき安全な代替手段を以下の表で確認してください。たとえば、<Tooltip tip="パスワードレス: 第 1 認証要素としてパスワードに依存しない認証の形式。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Passwordless">パスワードレス</Tooltip>認証を実装している場合は、

`oauth/ro` endpoint の代わりに [Universal Login](/docs/ja-jp/authenticate/login/auth0-universal-login) を使用してください。

<div id="grant-type-mapping">
  ## グラントタイプの対応
</div>

アプリケーションを登録すると、アプリケーションの種類、特に機密アプリケーションかパブリックアプリケーションかに応じて、利用できるグラントタイプが異なります。さらに、信頼できるファーストパーティアプリケーションでは、追加のグラントタイプも利用できます。

<div id="public-applications">
  ### パブリックアプリケーション
</div>

Native アプリケーションまたはシングルページアプリケーション (SPA) を Auth0 Dashboard で登録すると、自動的にパブリックアプリケーションとしてフラグ付けされます。これは、`token_endpoint_auth_method` フラグが `none` に設定されていることで示されます。デフォルトでは、Auth0 は次の `grant_types` が有効になったパブリックアプリケーションを作成します。

* `implicit`
* `authorization_code`
* `refresh_token`

Native アプリでは、`device_code` グラントタイプも使用できます。

パブリックアプリケーションでは、`client_credentials` グラントタイプは使用できません。このグラントタイプを使用するには、アプリケーションを公開ではなく機密として設定する必要があります。`token_endpoint_auth_method` を `client_secret_post`、`client_secret_basic`、または `private_key_jwt` に設定するには、Auth0 Management API の [Update a client](https://auth0.com/docs/api/management/v2#!/Clients/patch_clients_by_id) エンドポイントを使用します。詳しくは、[Application Credentials](/docs/ja-jp/secure/application-credentials) を参照してください。

<div id="confidential-applications">
  ### 機密アプリケーション
</div>

Regular Web Application または Machine-to-Machine (M2M) Application を Auth0 Dashboard に登録すると、自動的に機密アプリケーションとして扱われます。これは、`token_endpoint_auth_method` フラグが `none` 以外の値に設定されていることで示されます。デフォルトでは、Auth0 は次の `grant_types` を有効にした機密アプリケーションを作成します。

* `implicit`
* `authorization_code`
* `refresh_token`
* `client_credentials`

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

信頼できるファーストパーティアプリケーションでは、confidential applications と同じ `grant_types` が有効になっているほか、以下も有効になります。

* `password`
* `http://auth0.com/oauth/grant-type/password-realm`
* `http://auth0.com/oauth/grant-type/mfa-oob`
* `http://auth0.com/oauth/grant-type/mfa-otp`
* `http://auth0.com/oauth/grant-type/mfa-recovery-code`

Auth0 Dashboard を使用してこれらのグラントタイプを有効化または無効化する場合は、アプリケーションに `Password` または `MFA` グラントタイプを追加すると、すべての Password および <Tooltip tip="多要素認証（MFA）: SMS によるコードなど、ユーザー名とパスワードに加えて認証要素を使用するユーザー認証プロセス。" cta="用語集を表示" href="/docs/ja-jp/glossary?term=MFA">MFA</Tooltip> のグラントタイプが有効になる点に注意してください。これらを個別に選択することはできません。

<div id="third-party-application-restrictions">
  ## サードパーティアプリケーションの制限事項
</div>

[サードパーティアプリケーション](/docs/ja-jp/get-started/applications/third-party-applications)でサポートされるグラントタイプは、[OAuth 2.1のベストプラクティス](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1)に準拠した一部のものに限られます。

| **グラントタイプ**                                    | **サードパーティアプリケーションで利用可能** |
| ---------------------------------------------- | ------------------------ |
| `authorization_code`                           | はい (PKCE 必須)             |
| `refresh_token`                                | はい                       |
| `client_credentials`                           | はい (機密クライアントのみ)          |
| `implicit`                                     | いいえ                      |
| `password`                                     | いいえ                      |
| `urn:ietf:params:oauth:grant-type:device_code` | いいえ                      |
| MFA グラント                                       | いいえ                      |
| レガシーグラント                                       | いいえ                      |

詳しくは、[サードパーティアプリケーション向けのセキュリティコントロール](/docs/ja-jp/get-started/applications/third-party-applications/security-controls)を参照してください。

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

* [機密アプリケーションとパブリックアプリケーション](/docs/ja-jp/get-started/applications/confidential-and-public-applications)
* [サードパーティアプリケーション](/docs/ja-jp/get-started/applications/third-party-applications)
* [ファーストパーティアプリケーションとサードパーティアプリケーション](/docs/ja-jp/get-started/applications/first-party-and-third-party-applications)
* [サブドメインURLのプレースホルダー](/docs/ja-jp/get-started/applications/wildcards-for-subdomains)
