【问题标题】:connect to SMTP using Oauth2 Gmail使用 Oauth2 Gmail 连接到 SMTP
【发布时间】:2012-12-28 10:40:36
【问题描述】:

我正在尝试使用 Oauth2 for Gmail 连接 SMTP,但遇到以下问题。

Oauth 令牌和电子邮件名称 正确,可用于连接 IMAP。

我正在关注example of google

DEBUG SMTP: Authenticate with SASL
DEBUG SMTP: SASL mechanisms allowed: XOAUTH2
DEBUG SMTP: SASL AUTH command trace suppressed
DEBUG SMTP SASL: Mechanisms: XOAUTH2
DEBUG SMTP SASL: No SASL support
DEBUG SMTP: SASL authentication failed
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM 
DEBUG SMTP: AUTH LOGIN command trace suppressed
DEBUG SMTP: AUTH LOGIN failed


javax.mail.AuthenticationFailedException: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://support.google.com/mail/bin/answer.py?answer=14257 ol4sm17455809pbb.58

【问题讨论】:

    标签: smtp gmail google-oauth


    【解决方案1】:

    我只是忘记调用OAuth2Authenticator类的initialize()方法。

     public static void initialize() {
        Security.addProvider(new OAuth2Provider());
      }
    

    【讨论】:

    • 如果添加 initialize() 方法确实解决了您的问题,您能否将问题标记为已回答?谢谢。
    猜你喜欢
    • 2015-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多