【问题标题】:OAuth 2, cant send the mail exceptionOAuth 2,无法发送邮件异常
【发布时间】:2017-07-04 13:43:08
【问题描述】:

我正在尝试使用 oauth 2 令牌发送邮件,我已经有了它,但是当我要发送邮件时它根本不起作用。

我得到以下信息:

 {"status":"400","schemes":"Bearer","scope":"https://mail.google.com/"}

这是行不通的行:

 SMTPTransport smtpTransport = connectToSmtp("smtp.gmail.com", 587, user, oauthToken, true);

【问题讨论】:

    标签: java oauth gmail


    【解决方案1】:

    我是这样调用令牌的:

    String authURL = "https://accounts.google.com/o/oauth2/v2/auth?scope=email&"
    

    我为此更改了“电子邮件”:

    String authURL = "https://accounts.google.com/o/oauth2/v2/auth?scope=https://mail.google.com/%20profile&"
    

    我希望这对某人有所帮助

    【讨论】:

      猜你喜欢
      • 2013-10-22
      • 1970-01-01
      • 2016-11-02
      • 1970-01-01
      • 1970-01-01
      • 2015-11-20
      • 2023-03-10
      • 2012-11-10
      • 1970-01-01
      相关资源
      最近更新 更多