This field is used by clients to implement the Proof Key for Code Exchange (PKCE) extension of the OAuth 2 specification. The client first creates a code challenge which is sent to the server when requesting authorization. The client then uses the code verifier (the string used to create the code challenge) when exchanging the authorization code for an access token. In OAuth 2.1 it is required that clients use PKCE unless the following conditions are met:
- The client is a confidential client.
- In the specific deployment and the specific request, there is reasonable assurance by the authorization server that the client implements the OpenID Connect nonce mechanism properly.
Therefore, if the client is a confidential client and the nonce query parameter is specified, then the code_challenge query parameter is not required; otherwise, the code_challenge is required.