3

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?

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

5 Comments

how are you sending it; which tool/environment/language?
commandline curl would look like: curl -d "client_id=xxxxxxxxx&client_secret=xxxxxxxxxxx&grant_type=authorization_code&code=xxxxxxxxxx&redirect_uri=https://bigquery.cloud.google.com/dataset/projectid:datasetid" https://accounts.google.com/o/oauth2/token ; you should be able to verify with that
It worked. Thanks. I was using postman but it was not working there.
Would you tell me how I can get the value for "code" parameter ? I just have client_id , client_secret and redirect_uri
accounts.google.com/o/oauth2/v2/… Fill the response_type and client_id in this url and hit the url in browser. It will give you an option to login via mail id . Select and then you will see a url in browser which has 1 of its parameter as code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.