Search code examples
authenticationoauth-2.0google-bigqueryaccess-token

How to get google auth token from authorization code?


i tried to get the auth token as below:

https://accounts.google.com/o/oauth2/token?client_id=xxxxxxxxx&client_secret=xxxxxxxxxxx&grant_type=authorization_code&code=xxxxxxxxxx&redirect_uri=https://bigquery.cloud.google.com/dataset/projectid:datasetid

Though i already specified the grant_type parameter but still i am getting the below error:

 { "error" : "invalid_request", "error_description" : "Required parameter is missing: grant_type" }

What is the mistake i am doing here?


Solution

  • You need to use HTTP POST and put the values in POST parameters rather than providing them as query parameters in an HTTP GET request.