Google API OAuth2.0错误请求invalid_grant

时间:2014-05-07 15:04:29

标签: php http oauth-2.0 google-api bad-request

我需要我的服务器应用程序从谷歌API(https://accounts.google.com/o/oauth2/token方法)检索身份验证令牌,但我只得到400 respnse(错误请求)也返回{ "error" : "invalid_grant"}。这是我的请求数据:

{ ["method"]=> "POST" 
["header"]=> "Content-type: application/x-www-form-urlencoded" 
["content"]=> "client_id={my google client email}&client_secret={my secret code}&grant_type=authorization_code&code={returned temporary token}&redirect_uri=http%3A%2F%2Fwww.lunariumfashion.com%2Fsetup_picasa" } }

我正在使用此库进行身份验证https://github.com/philsturgeon/codeigniter-oauth2,也尝试使用AJAX进行攻击,结果类似。

我被困在这里24小时,读了我发现的一切,请帮助!

1 个答案:

答案 0 :(得分:1)

client_id不是您的电子邮件。这是Google在注册您的应用时为您提供的标识符。与secret相同。

按照此说明操作(忽略文档中对auth0的引用):https://docs.auth0.com/goog-clientid

相关问题