我想返回OAuth响应令牌的OAuth 2响应代码。然而,我的请求返回以下错误,谷歌中没有任何结果。我尝试将response_type
更改为"token"而不是"code",但也没有起作用。
OAuth 2参数只能有一个值:response_type
请求详情:
scope=https://www.googleapis.com/auth/userinfo.email
client_secret=_____
response_type=code
grant_type=authorization_code
redirect_uri=http://localhost/folder/
client_id=____.apps.googleusercontent.com
code=_____
我正在将这个第二步的数据包发送到 POST https://accounts.google.com/o/oauth2/auth
我的请求有什么问题?
编辑
我刚刚意识到应该使用 https://accounts.google.com/o/oauth2/token
URL 进行此请求。然而,现在更改到该URL会出现以下错误:
HTTP/1.0 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Fri, 27 Jul 2012 22:44:35 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
{
"error" : "invalid_request"
}
编辑2
移除response_type
并按上述更改URL解决了此问题。