0

My normal, non-admin G Suite users need to work out (programatically) whether they are in a specific G Suite group or not.

Plan A - G Suite Admin SDK

It would appear that one can do that with this call:

https://admin.googleapis.com/admin/directory/v1/groups/developers@example.com/hasMember/max@example.com

This does not work. If I authenticate as an admin, it works. But if I authenticate as max@example.com (note: I added all relevant scopes to token request), I get a 403 "Not Authorized to access this resource/api".

Is it intended that a user cannot query his own group membership via the G Suite Admin SDK?

Plan B - Google People API

I tried this API:

https://people.googleapis.com/v1/people/me?personFields=memberships

This returns a successful 200 response, but the group membership is not in there. The response is something like this, which is basically the standard empty response for that API:

{
  "resourceName": "people/107804923746527240895",
  "etag": "%EgMBNy4aBEAABQc="
}

Which API call can I make to find out whether I'm in a group or not?

Fletch
  • 4,829
  • 2
  • 41
  • 55

1 Answers1

0

Is it intended that a user cannot query his own group membership via the G Suite Admin SDK?

As the name says - it is an Admin Software development Kit - designed for admins. So unfortunately not accessible by non-admin users.

group membership is not in there

Unfortunately the People API only returns you

"domainMembership": {
        "inViewerDomain": true
      }

if you are an admin - so again not useful for you.

Conclusion - it is currently not possible for a user to see his group memberships

However, Google Public Issue Tracker allows you to file feature requests. This would allow you to let Google know that an important feature is missing and users request for it to be implemented.

ziganotschka
  • 25,866
  • 2
  • 16
  • 33