Reputation: 1270
I'm following this guide
When I try to authenticate a POP server connection, I have an error : "-ERR Authentication failure: unknown user name or bad password." Even with a valid access_token
Here is my process so far.
I granted POP.AccessAsUser.All
to my app on azure.
I'm connected with my user on Microsoft using the scope
offline_access https://outlook.office.com/POP.AccessAsUser.All
I retrieved a refresh_token,
With this refresh token, I requested a valid access_token with the scope
https://outlook.office.com/POP.AccessAsUser.All
With the access token and my email address, I generated the XOAUTH2
$XOAUTH2base64 = base64_encode("user=" .$this->username . "^Aauth=Bearer " . $this->token . "^A^A");
And the authentication fail
Here is a detail of the conversation (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.
What im i doing wrong?
Upvotes: -2
Views: 642
Reputation: 1270
My only mistake was generating $XOAUTH2base64
wrong.
The correct way of doing it in PHP is :
$XOAUTH2base64 = base64_encode("user=" .$this->username . "\1auth=Bearer " . $this->token . "\1\1");
Upvotes: 0