2016-01-08 249 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';你应该可以验证这个 –