向Google gmail API发出令牌请求时,错误请求400

时间:2015-05-20 05:18:52

标签: vb.net oauth google-api token bad-request

我按照此文档制作令牌请求https://developers.google.com/identity/protocols/OAuth2InstalledApp

在第一步中,它工作正常。我可以得到一个验证码。 在第二步中,我遇到了400 Bad Request的问题。我已经在2天内找到了这个问题的答案,但我无法解决问题。 我设置了所有属性,如文档,但它并不重要:

$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$referrer = $_SERVER['HTTP_REFERER'];

这是我的代码:

POST /oauth2/v3/token HTTP/1.1
Host: www.googleapis.com
Content-Type: application/x-www-form-urlencoded

code=4/v6xr77ewYqhvHSyW6UJ1w7jKwAzu&
client_id=8819981768.apps.googleusercontent.com&
client_secret=your_client_secret&
redirect_uri=https://oauth2-login-demo.appspot.com/code&
grant_type=authorization_code

谢谢你的回答!

1 个答案:

答案 0 :(得分:0)

我刚刚发现了一个错误。这是一个愚蠢的错误。我输入了client_secret的client_secrect inteads。我不能相信它花了我2天来修复这个错误。

相关问题