本文介绍了Outlook 365 OAuth 535 5.7.3 身份验证不成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用通过 https://login.microsoftonline.com/common/oauth2/v2.0/...但我收到以下错误:

535 5.7.3 认证不成功

我可以通过 https://login.live.com/获取身份验证令牌来使其工作oauth20_authorize.srf(旧 API)但仅适用于免费 Microsoft 帐户(我也需要支持企业/Outlook365 帐户).

我可以使用旧端点使其工作这一事实似乎证实了这一点:

  • 服务器支持 XOAUTH2(我也通过 Telnet EHLO 进行了验证)
  • 编码正确(我正在使用 this过程)
  • 我的意思是通过 XOAUTH2 传递完整的访问令牌,而不是像通过 LOGIN 传递它那样奇怪的东西,或者解码 JWT 并传递一些组件等

访问令牌似乎有效(它适用于其他调用,包括通过 Graph API 发送电子邮件).

我请求了以下范围:

['offline_access', 'User.Read', 'MailboxSettings.ReadWrite','Mail.Send', 'Mail.ReadWrite', 'Mail.Read', 'Mail.ReadBasic', 'Contacts.ReadWrite','Mail.Read.Shared', 'Mail.ReadWrite.Shared', 'Mail.Send.Shared', 'MailboxSettings.Read','profile', 'openid', 'email', 'Calendars.ReadWrite','EAS.AccessAsUser.All', 'EWS.AccessAsUser.All',];

对于遗留令牌(有效的令牌),范围不同:

['wl.emails', 'wl.offline_access', 'wl.imap'];

(我也尝试在请求 v2 令牌时包含这些范围,但它无效).

我尝试过的其他事情:

解决方案

截至目前,Office 365 SMTP 服务器不支持 OAuth 身份验证.

I'm trying to send an email via smtp.live.com using an OAuth token generated via https://login.microsoftonline.com/common/oauth2/v2.0/… but I'm receiving the following error:

535 5.7.3 Authentication unsuccessful

I can make it work by obtaining an auth token via https://login.live.com/oauth20_authorize.srf (a legacy API) but that only works for free Microsoft accounts (I need to support business/Outlook365 accounts too).

The fact I can make it work using that legacy endpoint seems to validate that:

  • The server supports XOAUTH2 (which I also validated via Telnet EHLO)
  • That the encoding is correct (I'm using this process)
  • That I'm meant to pass the full access token via XOAUTH2 and not something odd like pass it in via LOGIN, or decode the JWT and pass in some component etc.

The access token seems valid (it works for other calls, including sending an email via the Graph API).

I've requested the following scopes:

[
  'offline_access', 'User.Read', 'MailboxSettings.ReadWrite',
  'Mail.Send', 'Mail.ReadWrite', 'Mail.Read', 'Mail.ReadBasic', 'Contacts.ReadWrite',
  'Mail.Read.Shared', 'Mail.ReadWrite.Shared', 'Mail.Send.Shared', 'MailboxSettings.Read',
  'profile', 'openid', 'email', 'Calendars.ReadWrite',
  'EAS.AccessAsUser.All', 'EWS.AccessAsUser.All',
];

For the legacy token (the one which works), the scopes are different:

[
  'wl.emails', 'wl.offline_access', 'wl.imap'
];

(I've tried including these scopes when requesting the v2 token too, but it's invalid).

Other things I've tried:

解决方案

Office 365 SMTP servers do not support OAuth authentication as of this time.

这篇关于Outlook 365 OAuth 535 5.7.3 身份验证不成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:35