2012-10-25 68 views
1

我做了以下要求给Google的oauth2以获得访问令牌和我越来越有“INVALID_REQUEST” 400 HTTP响应:谷歌API的访问令牌返回400 - “INVALID_REQUEST”

POST /o/oauth2/token HTTP/1.1 
Host: accounts.google.com 
Connection: keep-alive 
Accept: */* 
User-Agent: NING/1.0 
Content-Length: 260 
Content-Type: application/x-www-form-urlencoded 

用下面的请求正文中的参数:

Map(redirect_uri -> http%3A%2F%2Flocalhost%3A8080%2Foauth%2Fgsheet, client_id -> _.apps.googleusercontent.com, code -> 4/9hzannwi_UlYWFlFEivgYXKzdGs6._, client_secret -> _, grant_type -> authorization_code) 

这真是让我烦恼,任何帮助/建议都非常感谢。

回答

0

我在编写引起问题的请求之前编码了redirect_uri。不这样做解决了这个问题。这似乎很奇怪,但是当我将用户发送到oauth2请求页面时,我编码了redirect_uri ...

相关问题