2016-01-08 545 views
2

我試圖讓下面的身份驗證令牌:雖然我已經指定了grant_type參數如何從授權碼獲取谷歌授權令牌?

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

但仍然我得到下面的錯誤:

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

什麼是錯誤,我很在這裏做?

回答

3

您需要使用HTTP POST並將這些值放在POST參數中,而不是將它們作爲查詢參數提供給HTTP GET請求。

+0

仍然收到相同的錯誤 – hmims

+0

你怎麼發送它;哪些工具/環境/語言? –

+0

commandline curl看起來像:'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';你應該可以驗證這個 –