I want to implement an HTTP call to Google Cloud Platform (GCP) to generate the Authorization token. Cant find a the correct GCP documentation for the same as well.
Using the reference from below URL, I was able to generate a Authorizaton token from Postman, using postmans Authorization UI and not the HTTP call UI. https://www.vulongtran.com/how-to-use-postman-with-google-cloud-platform-apis And the call to GCP API are working using the token generated from above process.
I tried implementing the same call via HTTP POST request, but not getting expected result.
HTTP POST
URL - https://accounts.google.com/o/oauth2/token
Query param-
grant_type:authorization_code redirect_uri:https://www.getpostman.com/oauth2/callback
Authorization - Basic Auth username - password -
Headers -
scope:https://www.googleapis.com/auth/cloud-platform redirect_uri:https://www.google.com
And the response that I get is
400 bad request
{ "error": "invalid_request", "error_description": "Missing required parameter: code" }
2nd Try- Also tried sending the in the request BODY, like below, but the result was same. { grant_type:'authorization_code', redirect_uri:'https://www.getpostman.com/oauth2/callback' }
Response { "error": "invalid_request", "error_description": "Missing required parameter: code" }
I saw another page, where 'code' is used in the call. Dont know what language the code on that page is for. But I am unable to figure out the correct HTTP call to get the token from there as well. Google OAuth2: Required parameter is missing: grant_type