2011-09-19 104 views
7

我相当新Oauth2.0。
我想开始使用Google Plus API。SSL需要使用谷歌加API吗?

我用下面的资源

Using OAuth 2.0 to Access Google APIs” 文档。

Google Plus Oauth Api范围键 (https://www.googleapis.com/auth/plus.me)。

玩过卷曲并与其他“范围键”成功后。我遇到了以下谷歌加范围错误(https://www.googleapis.com/auth/plus.me)。

“令牌无效 - AuthSub凭证有错误的范围”

然后我找到了解决办法Google’s OAuth Pain: Token invalid – AuthSub token has wrong scope

它指出以下

如果你得到一个当您尝试使用OAuth(或甚至AuthSub的)时,“令牌无效 - AuthSub令牌有错误的范围” 错误10事?),请确保您正在使用相同的协议 请求为您正在使用

我做了什么,他说的范围,采取了“S”关范围“

http://www.googleapis.com/auth/plus.me 

但现在它给了我这个错误

enter image description here

这是否意味着你的网站必须使用SSL?

感谢您的反馈。

编辑:原来我用错了API
应该https://www.googleapis.com/plus/v1/people/me?access_token=xxxx

+0

借助Google+ API,终点是什么? '的https:// www.googleapis.com /加/ V1 /'。 Google的OAuth2授权终端为“https:// accounts.google.com/o/oauth2/auth”。我没有在任何地方看到任何非HTTPS URI。 – dtb

+0

是的,如上所述,使用HTTPS版本导致“令牌无效 - AuthSub令牌有错误的范围” – Bodman

+0

您是否可以添加重现问题的步骤? – dtb

回答

3

OAuth范围更多的信息,我找到了答案,我用错了网址为API

https://www.googleapis.com/plus/v1/people/me的access_token = {散列}

+0

这是'blah'oauth_token收到您的回调url中,还是从验证器和请求令牌生成的访问令牌? – Kieveli

+0

blah是您授予的临时哈希。你用你的 [client_id,client_secret,code(authorization_code)]来检索它。将这些内容发布到https://accounts.google.com/o/oauth2/token会返回您的访问令牌 – Bodman