2011-09-19 103 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