1

I am trying to upload a message to a Google Group using this http call:

https://www.googleapis.com/upload/groups/v1/groups/mygroupname@domain.com/archive?ploadType=media&access_token=XYZ...

(Of course substituting the correct email address for the group, and the actual token). This produces the http error 401 (Authorization failed). The target account is Google Workspace. I am using a service account that has the Google Groups API enabled. I have added this scope to the service account and authorized it for my domain:

https://www.googleapis.com/auth/apps.groups.migration

As a test to make sure I have that scope authorized, I take the token that was generated and run it through this API:

https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=XYZ...

The json returned does have the apps.groups.migration scope (along with others for mail, calendar, etc.). I have no trouble accessing those other data types.

Any idea what I could be missing here?

Jeff McKay
  • 75
  • 5
  • Running into this same issue. Did you ever find a solution? – jayhendren Mar 16 '23 at 20:45
  • That problem seems to have gone away. I believe that the Google Groups API will only work with a service account - can't remember what I was using when I posted this, but it works now. I did run into an issue, getting http 400 (unable to parse) on the upload. Turns out, Google requires a Message-ID header in the RFC-822 message. – Jeff McKay Mar 21 '23 at 22:50
  • Hm, thanks for the info. Are you a domain admin for your domain? I'm trying to import to a group that I own, but I am not a domain admin. I suspect this may be the reason I'm getting 401s. – jayhendren Mar 22 '23 at 22:01
  • I do need to specify the administrator's email when I obtain the auth token, otherwise I do get the http 401 as you reported. As I mentioned, we use a service account that gives us access to all user's data. – Jeff McKay Mar 23 '23 at 23:21
  • Thanks for the info. That answers my question. I was trying to use either my own account or a service account I created, but no dice. I did ask my domain admin for a service account for the purposes of importing an archive, but they refused. So I guess in my particular case, I'm SOL. Weird to me that I can't import an archive to a list where I have the Owner role, but there's not much I can do about that except complain. – jayhendren Mar 24 '23 at 03:17

0 Answers0