Reputation: 21
I'm trying to get the access token using an http request.
According to the Oauth guide:
https://developers.google.com/identity/protocols/oauth2/web-server#incrementalAuth
the endpoint for exchanging authorization code to access token is https://oauth2.googleapis.com/token
but it gives a page can't be found HTTP 404 error
Here's my entire url (I've replaced the code, client id, and secrets)
https://oauth2.googleapis.com/token?
code=xxxxx&
client_id=xxxxx&
client_secret=xxxxx&
redirect_uri=http://localhost&
grant_type=authorization_code
Upvotes: 2
Views: 3606
Reputation: 1325
It looks like you are passing in the required fields as query parameters, but you need to put them in the post body and send an HTTPS POST request to https://oauth2.googleapis.com/token. You can find this information further down in the documentation you were referring to: https://developers.google.com/identity/protocols/oauth2/web-server#httprest_7.
Upvotes: 0