【问题标题】:Google Directory API returns 403 for user_list with showDeleted=trueGoogle Directory API 为 user_list 返回 403,showDeleted=true
【发布时间】:2018-03-03 05:17:12
【问题描述】:

我认为我已经应用了所有必要的范围/请求了以下必要的授权:

"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" 

我能够成功地在 Google 目录中查询用户列表,但是一旦我开始传递 show_deleted: "true" 我就会得到以下信息:

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

我在 API documentation 中找不到任何表明我需要请求不同的授权类型才能删除用户的内容。

【问题讨论】:

  • 你能提供代码 sn-p 你将 showDeleted 设置为 true 吗?

标签: google-admin-sdk


【解决方案1】:

查看您提供的same link,提到的范围是:

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

尝试使用它。

注意:

admin.directory.user

而不是

admin.directory.user.readonly

【讨论】:

  • 不幸的是,这也不起作用。我尝试请求/授予 API 提供的每个范围,但它并没有改变结果。我的直觉是,这与授予范围授权的 Google 帐户的权限有关。
  • 此服务帐号是否相关?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-08-12
  • 2014-12-12
  • 2018-03-16
  • 1970-01-01
  • 1970-01-01
  • 2015-12-28
  • 1970-01-01
相关资源
最近更新 更多