问题
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