【问题标题】:Error when trying to use Google Gmail API尝试使用 Google Gmail API 时出错
【发布时间】:2021-02-24 22:05:28
【问题描述】:

我正在尝试自动向一群人发送电子邮件。 我使用 credentials.json 进行身份验证和来自 gmail api 站点的示例代码。 错误:An error occurred: <HttpError 403 when requesting https://gmail.googleapis.com/gmail/v1/users/,<the account I used>/messages/send?alt=json returned "Request had insufficient authentication scopes."> 身份验证过程的问题在哪里?

【问题讨论】:

    标签: python authentication gmail-api


    【解决方案1】:

    来自Gmail API quickstart 的示例代码包含范围'https://www.googleapis.com/auth/gmail.readonly'

    但是,对于sending messages,您需要以下范围之一:

    将代码中的范围更改为列出的范围之一并删除令牌文件以在使用新范围运行代码时触发新的授权流程。

    【讨论】:

      猜你喜欢
      • 2023-03-14
      • 2020-08-04
      • 1970-01-01
      • 2016-11-16
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 2021-05-24
      • 2013-09-19
      相关资源
      最近更新 更多