Is there a way to retrieve all groups for a member as a Non Admin in the Google Directory API?

一个人想着一个人 提交于 2021-02-08 10:35:14

问题


I am working with the Google Directory API to retrieve all of the groups that a person is part of for role based privileging in the app I'm working on.

https://developers.google.com/admin-sdk/directory/v1/guides/manage-groups#get_all_member_groups

Our Admin is able to successfully retrieve a list of groups that he is a part of, using the API Explorer, but I am not. I am getting the error below and I'm assuming it is because I am not an Admin.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Not Authorized to access this resource/api"
   }
  ],
  "code": 403,
  "message": "Not Authorized to access this resource/api"
 }
}

How do we retrieve the groups a user belongs to? Is there any way to supply an Admin Credentials to retrieve the groups a user belongs to?


回答1:


There's no way for regular users to programmatically retrieve their group membership. I'd recommend creating a delegated admin with priveledges to read groups via the API but nothing else. Also, when doing the OAuth 2.0 request, only the readonly groups scope is needed. Share these credentials with any users that need to get their group membership or have your app make the api call as the delegated user on their behalf.



来源:https://stackoverflow.com/questions/31167385/is-there-a-way-to-retrieve-all-groups-for-a-member-as-a-non-admin-in-the-google

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!