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

# 認可リクエストでの PKCE 利用における S256 指定の強制化

> コードチャレンジメソッドとして S256 を指定するよう、クライアントに強制する設定を説明します。

<Info>
  For **Authlete 2.x** documentation, see [2.x version](/v2/configuration-reference/authorization-requests/requiring-s256).
</Info>

# 認可リクエストでの PKCE 利用における "S256" 指定の強制化

Authlete では、クライアントからの [PKCE (RFC 7636)](/ja/protocols-and-flows/protocol-extensions/proof-key-for-code-exchange-pkce)
の利用した認可リクエストに関し、"**code\_challenge\_method**" の値として ”**S256**" の指定を強制できます。

この機能を有効化するためには、サービス編集 → 「認可」タブ → 「認可エンドポイント」セクション にある「**コードチャレンジメソッド S256**」にて「**要求する**」を選択します。既定値は「要求しない」です。

<img src="https://mintcdn.com/authlete/NmFoIJ4VSX_LOgob/img/kb/ja/oauth-and-openid-connect/pkce-rfc-7636/requiring-s256_1.png?fit=max&auto=format&n=NmFoIJ4VSX_LOgob&q=85&s=28d2ed0da13ace3676ff42330f82aefd" alt="requiring-s256_1" width="906" height="1202" data-path="img/kb/ja/oauth-and-openid-connect/pkce-rfc-7636/requiring-s256_1.png" />

*「コードチャレンジメソッド S256」の設定*

「要求する」に設定された Authlete サービスでは、[/auth/authorization API](/api-reference/authorization-endpoint/process-authorization-request)
にて、"**code\_challenge\_method=S256**" を含まない認可リクエストの処理を拒否します。以下は処理例です（一部折り返しています）。認可リクエストは PKCE を用いていますが、 "code\_challenge\_method=plain" となっています。そのため Authlete は処理を拒否しています。

* リクエスト

```shell theme={null}
% curl -s -X POST .../auth/authorization
  -u ... -H 'Content-Type: application/json'
  -d '{ "parameters": "redirect_uri=...
    &response_type=code
    &client_id=...
    &scope=...
    **&code_challenge=...
    &code_challenge_method=plain" **}'
```

* レスポンス

```json theme={null}
{
  "type": "authorizationResponse",
  "resultCode": "A124308",
  "resultMessage": "[A124308] The value of the
    'code_challenge_method' request parameter
    must be 'S256'.",
...
```
