【问题标题】:Client doesn't have sufficient permission客户没有足够的权限
【发布时间】:2020-04-22 02:18:16
【问题描述】:

我正在跑步

library(googlesheets4)
sheets_auth()

dat=read_sheet("https://docs.google.com/spreadsheets/d/1R9XuH9Wej-p6HdkFGV2IsHuCmA9w0s7M3-jzE3S-Qrs/edit#gid=950673024", sheet="Summary", range=cell_rows(1:777))

并获得以下输出。

Suitable tokens found in the cache, associated with these emails:
  * dcallow@umd.edu
  * ddcc2442@gmail.com
The first will be used.
Using an auto-discovered, cached token.
To suppress this message, modify your code or options to clearly consent to the use of a cached token.
See gargle's "Non-interactive auth" vignette for more details:
https://gargle.r-lib.org/articles/non-interactive-auth.html
The googlesheets4 package is using a cached token for dcallow@umd.edu.
> 
> dat=read_sheet("https://docs.google.com/spreadsheets/d/1R9XuH9Wej-p6HdkFGV2IsHuCmA9w0s7M3-jzE3S-Qrs/edit#gid=950673024", sheet="Summary", range=cell_rows(1:777))
Error: Client error: (403) PERMISSION_DENIED
  * Client does not have sufficient permission. This can happen because the OAuth token does not have the right scopes, the client doesn't have permission, or the API has not been enabled for the client project.
  * The caller does not have permission

我不确定问题是否是它迫使我使用第一封电子邮件?是否可以更改为第二个令牌?但我也很困惑,为什么不再要求我进入我的谷歌帐户进行身份验证?

任何想法为什么会发生这种情况?我是 API 新手。

【问题讨论】:

  • 您是否尝试过退出所有会话并仅作为第二封电子邮件登录?另外,如果您已经获得了项目的token并且没有更改范围,则不需要再次认证,所以这是正常的。

标签: r google-sheets-api googlesheets4


【解决方案1】:

你可以试试这个

图书馆(googlesheets4)

gs4_auth_configure(api_key = "A.......bMGBUA")

您应该在凭据中创建一个 api 密钥 https://console.cloud.google.com/apis/credentials

我等待它可以帮助你

【讨论】:

    【解决方案2】:

    这可能是因为当您使用gs_auth 登录时,您一定选择了错误的权限。要重新分配您的权限,首先使用gs_deauth() 进行授权,然后使用gs_auth() 并在下一个选项中,在Selection: 中输入0 以重新初始化您对谷歌帐户的访问。 确保在分配权限时在浏览器窗口中选中复选框以读取、写入电子表格。

    如果你做不到请评论。

    继续编码!

    【讨论】:

      【解决方案3】:

      你也可以 在 googlesheet 页面上的“共享”按钮下,将 GoogleSheet 链接设置为“互联网上任何拥有此链接的人都可以查看”。 那么:

      googlesheets4::gs4_deauth()
      CellROSConc <- read_sheet("https://docs.google.com/spreadsheets/d/1bxTIKTNfv-n3Y-JMJCOlt14Ec3e4tSdBQZg-HiuypOY/edit?usp=sharing")
      

      【讨论】:

      • 这似乎是解决原始问题的一种非常不令人满意的不安全方法。
      猜你喜欢
      • 2021-09-13
      • 2015-12-14
      • 2021-07-10
      • 2020-06-08
      • 2020-01-26
      • 1970-01-01
      • 2014-01-24
      • 2021-01-31
      • 1970-01-01
      相关资源
      最近更新 更多