我遵循这个指南
当我尝试验证一个POP服务器连接时,我有一个错误:认证失败:未知的用户名或错误的密码。即使使用有效的access_token
这是我到目前为止的过程。
我将POP.AccessAsUser.All
授予我在azure上的应用程序。
我使用
范围与Microsoft上的用户连接offline_access https://outlook.office.com/POP.AccessAsUser.All
我检索了一个refresh_token,
使用这个刷新令牌,我请求了一个范围为
的有效的access_tokenhttps://outlook.office.com/POP.AccessAsUser.All
使用访问令牌和我的电子邮件地址,我生成了XOAUTH2
$XOAUTH2base64 = base64_encode("user=" .$this->username . "^Aauth=Bearer " . $this->token . "^A^A");
验证失败
下面是对话的细节(C: client, S: Server)
S: +OK The Microsoft Exchange POP3 service is ready. [...==]
C: AUTH XOAUTH2
S: +
C: {here i input my XOAUTH2base64}
S: -ERR Authentication failure: unknown user name or bad password.
我做错了什么?
我唯一的错误是生成$XOAUTH2base64
错误。
在PHP中正确的做法是:
$XOAUTH2base64 = base64_encode("user=" .$this->username . "1auth=Bearer " . $this->token . "11");