I'm trying write a script that migrates old emails over to a Google group. I've been hammering out a request in Google's OAuth2 Playground (https://developers.google.com/oauthplayground/, but I keep getting a 401 error that's caused by and invalid_token.
From the playground, I selected the groups migration API (https://www.googleapis.com/auth/apps.groups.migration), got an authorization code, and swapped it for an access_token. So it seemed like everything was going well. Then I made a did a POST request to this URL.
https://www.googleapis.com/upload/groups/v1/groups/TEST_GROUP@googlegroups.com/archive?uploadType=media
I've got the following two headers:
Content-Type : message/rfc822
uploadType : media
I should get an error about having some missing info in header, but instead I get I get an auth error.
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"
}
]
}
I gave auth consent while signed into the email that is the admin of the google groups account I've created.
Any idea what I'm going wrong?
Edit: added header info and specifier where I'm making this request for (URL for Google's Oauth playground)