I have a web app that uses the Google API. The process to authenticate makes two calls to google, the first to get a code
and the second to exchange the code
for a token
. Both calls take a redirect_uri
parameter. The first call uses this parameter as I expect, redirecting back to the redirect_uri
, however, the second call, to get the token, does not redirect, bar validating it it seems to ignore this parameter, so what is the point of it?
The redirect_uri
parameter in access token request is described as REQUIRED in the OAuth 2.0 specification.
The reason behind it is described in detail in the section 10.6 of the same document. In short:
request_uri
of authorization request. The only two parties who can notice this trick are victim (legitimate user) and server. Client remains unaware of these manipulations.redirect_uri
doesn't match with the one the server has seen, the request will be rejected.