Google Directory API returns 403 for user_list with showDeleted=true

自闭症网瘾萝莉.ら 提交于 2019-12-11 17:08:32

问题


I thought I had applied all of the necessary scopes / requested the necessary authorizations with the following:

"https://www.googleapis.com/auth/admin.directory.customer.readonly",
"https://www.googleapis.com/auth/admin.directory.domain.readonly",
"https://www.googleapis.com/auth/admin.directory.user.readonly" 

I am able to query the Google Directory for a user list successfully, but as soon as I start passing show_deleted: "true" I get the following:

Caught error forbidden: Not Authorized to access this resource/api
Error - #<Google::Apis::ClientError: forbidden: Not Authorized to access this resource/api>

Google::Apis::ClientError: forbidden: Not Authorized to access this resource/api

I cannot find anything in the API documentation that suggests I needed to request a different authorization type to get deleted users.


回答1:


Looking at the same link you've provided, the mentioned scopes are:

https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.user

Try using that instead.

Note:

admin.directory.user

and not

admin.directory.user.readonly


来源:https://stackoverflow.com/questions/46350946/google-directory-api-returns-403-for-user-list-with-showdeleted-true

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