2014-09-26 57 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

相关问题