问题描述
我正在尝试使用通过 https://login.microsoftonline.com/common/oauth2/v2.0/...但我收到以下错误:
535 5.7.3 认证不成功
我可以通过 https://login.live.com/获取身份验证令牌来使其工作oauth20_authorize.srf(旧 API)但仅适用于免费 Microsoft 帐户(我也需要支持企业/Outlook365 帐户).
我可以使用旧端点使其工作这一事实似乎证实了这一点:
- 服务器支持
XOAUTH2
(我也通过 TelnetEHLO
进行了验证) - 编码正确(我正在使用 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 令牌时包含这些范围,但它无效).
我尝试过的其他事情:
- 使用 smtp.office365.com 而不是 smtp.live.com
- 获取新的访问令牌
- 根据这篇文章
- 启用 Exchange SMTP 身份验证
截至目前,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 TelnetEHLO
) - 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 viaLOGIN
, 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:
- Using smtp.office365.com instead of smtp.live.com
- Obtaining fresh access tokens
- Ensuring app settings/permissions are configured correctly, as per this article
- Enable Exchange SMTP Auth
Office 365 SMTP servers do not support OAuth authentication as of this time.
这篇关于Outlook 365 OAuth 535 5.7.3 身份验证不成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!