Requested client not authorized

前端 未结 3 1884
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-22 04:16

I am trying to get google users from my domain using google service account.

But it throws error

Error:\"access_denied\", Description:\         


        
3条回答
  •  庸人自扰
    2020-12-22 04:36

    You need to give your service-account/API project access to your domain first. Steps detailed in the docs here:

    https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account

    You need to specify the correct scopes you need in step 6 of those instructions, which would be https://www.googleapis.com/auth/admin.directory.user.readonly to access the list of users.

    In addition for the Directory API to work you need to enable API access in the domain settings: https://developers.google.com/admin-sdk/directory/v1/guides/prerequisites#set_up_api

提交回复
热议问题