1

我正在向 google oauth2 发出以下请求以获取访问令牌,并获得带有“invalid_request”的 400 http 响应:

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)

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

4

1 回答 1

0

在发出导致问题的请求之前,我正在对 redirect_uri 进行编码。不这样做解决了问题。然而,这似乎很奇怪,因为我在将用户发送到 oauth2 请求页面时对 redirect_uri 进行了编码......

于 2012-10-25T10:37:56.630 回答