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

# 有効なトークンのイントロスペクションで返る responseContent

> 有効なアクセストークンをイントロスペクションしたときに responseContent が Bearer error="invalid_request" となる理由を説明します。

有効なアクセストークンを Authlete の [/auth/introspection](/api-reference/introspection-endpoint/process-introspection-request)
API に送ると、トークンが有効であることを示すレスポンスが返りますが、その
`responseContent` の値は `Bearer error="invalid_request"` となっています。

```json highlight={4,10} theme={null}
{
  "resultCode": "A056001",
  "resultMessage": "[A056001] The access token is valid.",
  "action": "OK",
  "clientId": 1048476397,
  "subject": "user123",
  "existent": true,
  "usable": true,
  "refreshable": true,
  "responseContent": "Bearer error=\"invalid_request\"",
  "expiresAt": 1789564514000
}
```

これは異常を示すものではありません。イントロスペクションの結果を表すのは
`action` であり、`OK` はアクセストークンが存在し有効期限内であること、つまり
リソースサーバーが保護リソースを返してよいことを意味します。

`responseContent` は結果ではなく、リソースサーバーがリクエストを拒否する場合に
`WWW-Authenticate` ヘッダーへ設定できる値としてあらかじめ用意されたものです。
`Bearer error="invalid_request"` は `400 Bad Request` に使える最も単純な文字列で、
`action` が `OK` のときはトークン自体に問題がないため、この値が返ります。

```http theme={null}
HTTP/1.1 400 Bad Request
WWW-Authenticate: Bearer error="invalid_request"
Cache-Control: no-store
Pragma: no-cache
```

実際の運用では、この文字列をそのまま返すのではなく、リクエストの何が誤っているのかを
クライアントに伝えることをおすすめします。`invalid_request` だけではクライアント
アプリケーションの開発者が対処できないためです。

なお `responseContent` は `Bearer` トークンタイプ（[RFC 6750](https://www.rfc-editor.org/rfc/rfc6750)）
を前提とした形式です。別のトークンタイプを使用するサービスでは、エラーレスポンスを
自前で組み立てる必要があります。

See also:

* [JavaDoc for Class IntrospectionResponse](https://authlete.github.io/authlete-java-common/com/authlete/common/dto/IntrospectionResponse.html)
