A typical OAuth2 Authorization Code Flow scenario looks like this:
What I'm not understanding is the purpose of the client secret in steps 6 and 7. If the auth server is guaranteed to redirect back to the web app and send its authorization code there, how could an attacker get the authorization code (which is presumably the reason for the client secret)?
In addition, it seems that the PKCE extension does away with the need for the client secret, but reading the RFCthe RFC for that I can't see any reason why it should. Could somebody explain this for me?