Imagine this attack
- An attacker intercepts the first call to the authorization server, then they have the code-challenge. (step 1 in the diagram)
- The attacker now intercepts the response from the authorization server with the authorization code. (step 2 in the diagram)
- Then the attacker can POST the authorization-code and the code-verifier to get the access token. (step 3)
Questions
What prevents the attacker intercepting the first call to the authorization server? This is what is meant to make authorization code + PKCE more secure than implicit flow.
Perhaps it does not matter if the call is intercepted because the code-challenge is hashed and therefore the attacker does not have the code-verifier required for the 2nd call. But what if the code-challenge is not hashed?