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

# OIDC におけるリフレッシュトークン

> OIDC 準拠パイプラインがリフレッシュトークンの利用にどのような影響を与えるかを説明します。

OIDC 準拠パイプラインでは、リフレッシュトークン (リフレッシュトークン: ユーザーに再度ログインを求めることなく、新しいアクセストークンを取得するために使用されるトークンです。) について次のような変更があります。

* 認証に [インプリシットグラント](/docs/docs/ja-jp/get-started/authentication-and-authorization-flow/implicit-flow-with-form-post) を使用した場合、返されなくなります。
* [機密アプリケーション](/docs/docs/ja-jp/get-started/applications/confidential-and-public-applications) で使用できます。
* パブリックアプリケーションが PKCE を使用した 認可コードフローを使用する場合、[リフレッシュトークンのローテーション](/docs/docs/ja-jp/secure/tokens/refresh-tokens/refresh-token-rotation) と併用できます。
* [`/delegation`](/docs/docs/ja-jp/api/authentication#delegation) エンドポイントは非推奨であるため、新しいトークンを取得するには [`/oauth/token`](/docs/docs/ja-jp/api/authentication#refresh-token) エンドポイントを使用する必要があります。

また、リフレッシュトークンの構造にも違いがあります。詳しくは、[リフレッシュトークン](/docs/docs/ja-jp/secure/tokens/refresh-tokens) をご覧ください。

## レガシー (委譲)

```json lines theme={null}
POST /delegation
Content-Type: 'application/json'
{
  "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
  "client_id": "...",
  "refresh_token": "...",
  "scope": "openid profile"
}
```

## OIDC準拠 (トークンエンドポイント)

```http lines theme={null}
POST /oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=123&client_id=123&client_secret=123&scope=openid+profile&audience=https%3A%2F%2Fapi.example.com
```

* `audience` と `client_secret` のパラメーターは省略可能です。
* パブリックアプリケーションの `refresh_token` をリクエストする場合、`client_secret` は不要です。

> [!WARNING]
>
> リフレッシュトークンは、送信時と保存時の両方で機密として扱う必要があり、認可サーバーと、そのリフレッシュトークンの発行先であるクライアント以外と共有すべきではありません。

## 詳しくはこちら

* [OIDC でのアクセストークン](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-access-tokens)
* [OIDC での外部 API](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-apis)
* [OIDC での認可コードフロー](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-auth-code-flow)
* [OIDC でのクライアント認証情報フロー](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-client-credentials-flow)
* [OIDC での委譲](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-delegation)
* [OIDC での Implicit Flow](/docs/docs/ja-jp/authenticate/login/oidc-conformant-authentication/oidc-adoption-implicit-flow)
