You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bamboo通过Gmail API发信提示缺少认证凭据如何解决

解决方案
  • 修正Bamboo Mailer的sub参数配置
    Bamboo GmailAdapter的sub字段需要填写G Suite域下你要模拟发信的真实用户邮箱地址,原配置错误填写了服务账号地址,导致身份模拟失败,无法生成合法OAuth2访问凭证。
    修正后配置参考:
    config :fajalobi, Fajalobi.Mailer,
           adapter: Bamboo.GmailAdapter,
           sub: "实际域内用户邮箱@你的企业域名.com",
           sandbox: false
    
    config :goth, json:  "priv/keys/你的服务账号密钥文件名.json" |> File.read!
    
  • 修正全域权限委派的作用域配置
    你列出的作用域存在两个地址连写的错误,需要拆分后再在Google Admin后台的全域权限委派页面绑定到服务账号的客户端ID:
    正确拆分后的作用域列表:
    https://www.googleapis.com/auth/gmail.addons.current.action.compose
    https://www.googleapis.com/auth/gmail.addons.current.message.metadata
    https://www.googleapis.com/auth/userinfo.email
    https://www.googleapis.com/auth/script.locale
    https://mail.google.com/
    https://www.googleapis.com/auth/gmail.modify
    https://www.googleapis.com/auth/gmail.compose
    https://www.googleapis.com/auth/gmail.send
    https://www.googleapis.com/auth/gmail.addons.execute
    https://www.googleapis.com/auth/script.send_mail
    https://www.googleapis.com/auth/gmail.settings.basic
    
    确认服务账号的客户端ID已被授予上述所有作用域的全域访问权限。
  • 验证服务账号密钥文件有效性
    确认priv/keys/路径下的服务账号JSON密钥文件存在、文件权限正常可被应用读取,文件内容未被篡改。
  • 可选优化:精简作用域
    如果你仅需要实现发信功能,可将作用域精简为https://www.googleapis.com/auth/gmail.send,减少权限冗余。

内容的提问来源于stack exchange,提问作者Kristof van Woensel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.14 11:45:03