> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-actions-triggers-prototype.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# トークンの取得

> ...

`POST /oauth/token`

トークンベースの認証では、`oauth/token`エンドポイントを使ってアプリケーション用のアクセストークンを取得し、セキュアなAPIに認証された呼び出しを行います。あるいは、IDトークンとリフレッシュトークンを取得することもできます。IDトークンには、ユーザーエクスペリエンスを向上させるため、アプリケーションがスコープの形式で抽出できるユーザー情報が含まれています。リフレッシュトークンは、現在のトークンの有効期限が切れてもユーザーエクスペリエンスを中断することなくアプリケーションが新たなアクセストークンを要求できるようにします。詳細については、「[IDトークン](https://auth0.com/docs/ja-jp/secure/tokens/id-tokens)」と「[リフレッシュトークン](https://auth0.com/docs/ja-jp/secure/tokens/refresh-tokens)」を参照してください。

リフレッシュトークンを取得できるOAuth 2.0フローは以下に限るので注意してください：

* [認可コードフロー（認可コード）](https://auth0.com/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow)
* [PKCEを使った認可コードフロー（PKCEを伴う認可コード）](https://auth0.com/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce)
* [リソース所有者のパスワード](https://auth0.com/docs/ja-jp/get-started/authentication-and-authorization-flow/resource-owner-password-flow)
* [デバイス認可フロー](https://auth0.com/docs/ja-jp/get-started/authentication-and-authorization-flow/device-authorization-flow)
* トークンの交換\*

これは、APIへのアクセスに通常のWebアプリが使うフローです。このエンドポイントを使って認可コードをトークンと交換します。

## Parameters

<ParamField body="grant_type" type="string">
  使用するフローを示します。認可コードには`authorization_code`を使用します。
</ParamField>

<ParamField body="client_id" type="string">
  アプリケーションのクライアントIDです。
</ParamField>

<ParamField body="client_secret" type="string">
  アプリケーションのクライアントシークレットです。
</ParamField>

<ParamField body="code" type="string">
  最初の`/authorize`呼び出しから受け取った認可コードです。
</ParamField>

<ParamField body="redirect_uri" type="string">
  これは、[GET /authorize](#authorization-code-grant)エンドポイントで設定されていた場合のみ必要です。`/authorize`からの値は`/oauth/token`で設定した値と一致する必要があります。
</ParamField>

## Response

| Status | Description |
| ------ | ----------- |
| 200    | トークン取得の成功   |
