2014-09-26 38 views
2

我正在嘗試編寫一個將舊電子郵件遷移到Google羣組的腳本。我已經敲定在谷歌的OAuth2用戶遊樂場(https://developers.google.com/oauthplayground/的請求,但一直收到的是真實的和INVALID_TOKEN造成一個401錯誤。羣組遷移API返回無效令牌...來自OAuth2 Playground

從操場上,我選擇了組遷移API(https://www.googleapis.com/auth/apps.groups.migration),得到一個授權碼和交換它的的access_token所以似乎好像一切都很順利然後,我做了一個做了一個POST請求到這個URL

https://www.googleapis.com/upload/groups/v1/groups/[email protected]/archive?uploadType=media

我有以下兩個頭:。

Content-Type : message/rfc822 uploadType : media

我應該得到一個有關頭部中有一些缺失信息的錯誤,但相反,我得到一個認證錯誤。

HTTP/1.1 401 Unauthorized Alternate-protocol: 443:quic,p=0.002 Content-length: 251 Via: HTTP/1.1 GWA X-google-cache-control: remote-fetch Server: UploadServer ("Built on Sep 18 2014 17:00:06 (1411084806)") Date: Fri, 26 Sep 2014 15:56:13 GMT Content-type: application/json; charset=UTF-8 Www-authenticate: Bearer realm="https://accounts.google.com/AuthSubRequest", error=invalid_token { "error": { "code": 401, "message": "Authorization Failed", "errors": [ { "locationType": "header", "domain": "global", "message": "Authorization Failed", "reason": "authError", "location": "Authorization" } ] }

我給了權威性的同意,同時登錄了帳戶是我創建了谷歌羣的管理員的電子郵件。

任何想法我要去錯了嗎?

編輯:添加頭信息和在那裏我提出這個要求的(網址爲谷歌的OAuth園地)符

+1

您從哪裏發佈POST,並且可以將POST請求URL和標題複製到問題中。 – pinoyyid 2014-09-26 22:33:41

+0

我正在從Google自己的OAuth操場發表帖子。我已經相應地更新了我的帖子。 – 2014-09-28 18:46:14

回答

0

這是一個消費谷歌集團(電子郵件地址@ googlegroups.com)或者是一個谷歌屬於Google Apps域的組? (@ yourcompany.com)

請注意,API僅適用於Google Groups for Business。您必須以Google Apps超級用戶身份驗證身份,然後發佈到Google Groups for Business組(不會以@ googlegroups.com結尾)。這些要求是spelled out in the documentation

相關問題