> ## 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.

# Authentication API

> Authentication API を使用すると、Auth0 の利用時にユーザーのアイデンティティに関するあらゆる要素を管理できます。ユーザーのログイン、サインアップ、ログアウト、API へのアクセスなどを実現するためのエンドポイントが提供されます。

Authentication API を使用すると、Auth0 の利用時にユーザーのアイデンティティに関するあらゆる要素を管理できます。ユーザーのログイン、サインアップ、ログアウト、API へのアクセスなどを実現するためのエンドポイントが提供されます。

この API は、[OpenID Connect](https://auth0.com/docs/authenticate/protocols/openid-connect-protocol)、[OAuth 2.0](https://auth0.com/docs/authenticate/protocols/oauth)、[FAPI](https://auth0.com/docs/secure/highly-regulated-identity#advanced-security-with-openid-connect-fapi-)、[SAML](https://auth0.com/docs/protocols/saml) など、さまざまなアイデンティティプロトコルをサポートしています。

<Note>
  この API は、RESTful API との連携に慣れている方向けに設計されています。より手順に沿った方法をご希望の場合は、[Quickstarts](https://auth0.com/docs/quickstarts) または [Libraries](https://auth0.com/docs/libraries) をご覧ください。
</Note>

<div id="base-url">
  ## ベースURL
</div>

Authentication API は HTTPS で提供されています。ドキュメント内で参照されるすべての URL のベースは次のとおりです。`https://{yourDomain}`

<div id="authentication-methods">
  ## 認証方法
</div>

この API で認証する方法は、次の 5 つです。

* OAuth 2.0 アクセストークン
* Client ID とクライアントアサーション (機密アプリケーション)
* Client ID と Client Secret (機密アプリケーション)
* Client ID (パブリックアプリケーション)
* mTLS 認証 (機密アプリケーション)

<div id="oauth2-access-token">
  ### OAuth 2.0 アクセストークン
</div>

`Bearer`認証方式を使用して、有効なアクセストークンを`Authorization` headerに含めて送信します。

例として、[Get User Info endpoint](/user-profile/get-user-info)があります。このシナリオでは、ユーザーを認証するとアクセストークンを取得でき、その後、そのトークンを`Authorization` headerに含めて[Get User Info endpoint](/user-profile/get-user-info)にリクエストを送信し、ユーザーのプロファイルを取得できます。

<div id="client-id-and-client-assertion">
  ### Client ID とクライアントアサーション
</div>

認証のために、署名付きの JSON Web トークン (JWT) を含む [クライアントアサーション](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authenticate-with-private-key-jwt) を生成します。リクエスト本文には、Client ID、値を `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` とする `client_assertion_type` パラメータ、そして署名済みアサーションを含む `client_assertion` パラメータを含めます。例については、[Private Key JWT](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authenticate-with-private-key-jwt) を参照してください。

<div id="client-id-and-client-secret">
  ### Client ID と Client Secret
</div>

Client ID と Client Secret を送信します。このデータの送信方法は、アプリケーションに設定されている [Token Endpoint Authentication Method](/docs/ja-jp/get-started/applications/confidential-and-public-applications) によって決まります。

**Post** を使用している場合は、このデータをリクエストの JSON ボディで送信する必要があります。

**Basic** を使用している場合は、`Basic` 認証方式を使って、このデータを `Authorization` header で送信する必要があります。資格情報の値を生成するには、Client ID と Client Secret をコロン (`:`) でつなげ、Base64 でエンコードします。

例として、[Revoke Refresh Token endpoint](https://auth0.com/docs/secure/tokens/refresh-tokens/revoke-refresh-tokens) があります。このオプションは、機密アプリケーションでのみ使用できます (たとえば、資格情報を権限のない第三者に公開することなく安全に保持できるアプリケーションです) 。

<div id="client-id">
  ### Client ID
</div>

Client IDを送信します。パブリックアプリケーション (SPAやモバイルアプリなど、資格情報を安全に保持できないアプリケーション) の場合は、Client IDだけでアクセスできるエンドポイントがいくつかあります。

その一例が[Implicit Grant](/implicit-flow/authorize)です。

<div id="mtls-authentication">
  ### mTLS 認証
</div>

証明書を生成します。[自己署名](https://auth0.com/docs/get-started/applications/configure-mtls/configure-mtls-for-a-client#self-signed-certificates)または[認証局署名付き証明書](https://auth0.com/docs/get-started/applications/configure-mtls/configure-mtls-for-a-client#certificate-authority-signed-certificates)のいずれかを使用できます。次に、mTLS ハンドシェイクを実行する [Customer Edge ネットワークを設定](https://auth0.com/docs/get-started/applications/configure-mtls/set-up-the-customer-edge)します。

エッジネットワークで証明書を検証したら、次のヘッダーを付けてリクエストを Auth0 のエッジネットワークに転送します。

* カスタムドメインの API key を `cname-api-key` ヘッダーとして指定します。
* クライアント証明書を `client-certificate` ヘッダーとして指定します。
* クライアント証明書の CA 検証ステータスを `client-certificate-ca-verified` ヘッダーとして指定します。詳しくは、[リクエストを転送する](https://auth0.com/docs/get-started/applications/configure-mtls/set-up-the-customer-edge#forward-the-request-)を参照してください。

詳しくは、[mTLS で認証する](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authenticate-with-mtls)をご覧ください。

<div id="parameters">
  ## パラメータ
</div>

GETリクエストでは、パス内のセグメントとして指定されていないパラメータは、HTTPのクエリ文字列パラメーターとして渡せます。

`GET https://{yourDomain}/some-endpoint?param=value&param=value`

POSTリクエストでは、URLに含まれないパラメータは、Content-Type に `application/json` を指定したJSONとしてエンコードする必要があります。

`curl --request POST --url 'https://{yourDomain}/some-endpoint' --header 'content-type: application/json' --data '{"param": "value", "param": "value"}'`

<Note>
  ただし、[SAML IdP-Initiated シングルサインオン (SSO) フロー](#idp-initiated-sso-flow) は例外で、クエリ文字列パラメーターと `x-www-form-urlencoded` の値を併用します。
</Note>

<div id="testing">
  ## テスト
</div>

[Authentication API Debugger](https://auth0.com/docs/customize/extensions/authentication-api-debugger-extension) を使って、エンドポイントをテストできます。

<div id="authentication-api-debugger">
  ### Authentication API Debugger
</div>

[Authentication API Debugger](https://auth0.com/docs/customize/extensions/authentication-api-debugger-extension) は、Authentication API の複数のエンドポイントをテストするために使用できる Auth0 の拡張機能です。

[Debugger をインストール](https://auth0.com/docs/customize/extensions/authentication-api-debugger-extension)

**すでに拡張機能をインストールしている場合は、Authentication API Debugger に進んでください。**

リンクは、テナントのリージョン (US West、Europe Central、または Australia) によって異なります。テナントのリージョンについて詳しくは、[テナントを作成する](https://auth0.com/docs/get-started/auth0-overview/create-tenants#region-locality-and-sub-locality) を参照してください。

<div id="configure-connections">
  ### 接続を設定する
</div>

1. *Configuration* タブで、**Application** (テストに使用するアプリケーションを選択) および **Connection** (使用するソーシャル接続名) の各フィールドを設定します。

2. **Callback URL** をコピーし、[Application Settings](https://manage.auth0.com/dashboard/) の **Allowed Callback URLs** に追加します。

3. *OAuth2 / OIDC* タブで、**OAuth2 / OIDC Login** を選択します。

<div id="endpoint-options">
  ### エンドポイントのオプション
</div>

以下のオプションを使用して、他のエンドポイントを設定します。

* パスワードレス: *OAuth2 / OIDC* タブで、`connection=sms` の場合は **Username** にユーザーの電話番号を、`connection=email` の場合はユーザーのメールアドレスを設定し、**Password** にはユーザーの確認コードを設定します。**Resource Owner Endpoint** をクリックします。
* SAML SSO:  *Other Flows* タブで **SAML** を選択します。
* WS-Federation: *Other Flows* タブで **WS-Federation** を選択します。
* Logout: *Other Flows* タブで **Logout** を選択するか、ユーザーをアイデンティティプロバイダーからもログアウトさせる場合は **Logout (Federated)** を選択します。
* レガシー Login: *OAuth2 / OIDC* タブで、**ID トークン**、**リフレッシュトークン**、**Target Client ID** の各フィールドを設定します。**委譲** をクリックします。
* レガシー Delegation: *OAuth2 / OIDC* タブで、**Username** と **Password** を設定します。**Resource Owner Endpoint** をクリックします。
* レガシー Resource Owner:  *OAuth2 / OIDC* タブで、**Username** と **Password** を設定し、**Resource Owner Endpoint** を選択します。

<div id="authentications-flows">
  ### 認証フロー
</div>

次のオプションで認証フローを設定します。

* 認可コードフロー: *OAuth2 / OIDC* タブで、**認可コード** フィールドに [Authorization Code Grant](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow) で取得したコードを設定し、**Code Verifier** フィールドにキーを入力します。**OAuth2 Code Exchange** をクリックします。
* 認可コードフロー + PKCE: *OAuth2 / OIDC* タブで、**認可コード** フィールドに [Authorization Code Grant](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce) で取得したコードを設定し、**Code Verifier** フィールドにキーを入力します。**OAuth2 Code Exchange** をクリックします。
* クライアントクレデンシャルフロー:  *OAuth2 / OIDC* タブで、**OAuth2 Client Credentials** を選択します。

<div id="errors">
  ## エラー
</div>

エラーが発生すると、エラーオブジェクトが返されます。これらのエラーオブジェクトのほとんどにはエラーコードとエラーの説明が含まれており、アプリケーションが問題をより効率的に特定できるようになっています。

`4xx` のHTTPレスポンスコードを受け取った場合は、クライアント側の不正なリクエストであると考えられます。

`5xx` エラーはAuth0側の問題を示しているため、この場合は [Auth0 Status Page](https://status.auth0.com/) と [Twitterの@auth0status](https://twitter.com/auth0status) を確認して、システムの稼働状況をご確認ください。

それ以外の場合は、[サポートオプション](#support)をご利用ください。

<div id="rate-limiting">
  ## レート制限
</div>

Authentication API にはレート制限が適用されます。制限値はエンドポイントごとに異なります。

特定のエンドポイントで定められたレート制限を超えると、次のメッセージを含む `429 Too Many Requests` レスポンスが返されます。`Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.`

レート制限の詳細については、[Auth0 API Rate Limit Policy](https://auth0.com/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy) を参照してください。

なお、データベース接続では、ユーザーアカウントと IP アドレスに応じて、特定の種類の繰り返されるログイン試行が Auth0 によって制限されます。詳細については、[Rate Limits on User/Password Authentication](https://auth0.com/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy) を参照してください。

<div id="support">
  ## サポート
</div>

問題が発生した場合やサポートが必要な場合は、いつでも[サポート](https://support.auth0.com/)までお問い合わせいただけます。

Freeサブスクリプションプランをご利用で、22日間のトライアル期間外の場合は、[Support Center](https://support.auth0.com/)にアクセスしたり、サポートチケットを作成したりすることはできません。この場合は、[Auth0 Community](https://community.auth0.com/)を通じてサポートを受けることができます。サポートプログラムの詳細については、[Support Options](https://auth0.com/docs/troubleshoot/customer-support)を参照してください。
