OAuth code flow trades a code for a token
Keeping the token on the server and giving the browser only a short-lived code shrinks the surface for token theft in the URL or the log. The browser gets a code, not a token The browser is deliberately the wrong place for the access token. In the authorization-code flow the browser goes to the authorization server, sees the consent screen, and comes back at the redirect URI carrying only a short authorization code, never the token. The token stays off the browser’s URL history and out of its logs, because it is the backend that presents the code together with the client secret to the token endpoint. That split of labour — the browser carries the code, the server owns the secret — is the entire point of the flow. ...