WIP OAuth for mail, fixed not getting access-token from Microsoft

thought it's still not working: "Mailserver denied authentication" with the access-token we get :(
Must be something wired and MS specific, as it's working now with GMail
This commit is contained in:
ralf 2022-12-26 17:25:47 -06:00
parent 71aabaea73
commit 6895d00160

View File

@ -51,7 +51,7 @@ class OpenIDConnectClient extends \Jumbojett\OpenIDConnectClient
* @var array[] email-regexp => [imap-host, smtp-host, oauth-provider, client-id, client-secret, scopes] pairs * @var array[] email-regexp => [imap-host, smtp-host, oauth-provider, client-id, client-secret, scopes] pairs
*/ */
public static $oauth_domain_regexps = [ public static $oauth_domain_regexps = [
'/(^|@)([^.]+\.onmicrosoft\.com)$/i' => ['outlook.office365.com', 'smtp.office365.com', 'login.microsoftonline.com/$2', '/(^|@)([^.@]+\.onmicrosoft\.com)$/i' => ['outlook.office365.com', 'smtp.office365.com', 'login.microsoftonline.com/$2',
'e09fe57b-ffc5-496e-9ef8-3e6c7d628c09', 'Hd18Q~t-8_-ImvPFXlh8DSFjWKYyvpUTqURRJc7i', 'e09fe57b-ffc5-496e-9ef8-3e6c7d628c09', 'Hd18Q~t-8_-ImvPFXlh8DSFjWKYyvpUTqURRJc7i',
'https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send offline_access email', 'https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send offline_access email',
[self::ADD_CLIENT_TO_WELL_KNOWN => 'appid']], [self::ADD_CLIENT_TO_WELL_KNOWN => 'appid']],
@ -88,7 +88,7 @@ class OpenIDConnectClient extends \Jumbojett\OpenIDConnectClient
return [ return [
'imap' => $imap, 'imap' => $imap,
'smtp' => $smtp, 'smtp' => $smtp,
'provider' => $provider ? 'https://'.strtr($provider, ['$1' => $matches[1] ?? null, '$2' => $matches[2] ?? null]): null, 'provider' => $provider ? 'https://'.strtr($provider, ['$1' => $matches[1] ?? 'common', '$2' => $matches[2] ?? 'common']): null,
'client' => $client, 'client' => $client,
'secret' => $secret, 'secret' => $secret,
'scopes' => array_merge(['openid'], explode(' ', $scopes)), 'scopes' => array_merge(['openid'], explode(' ', $scopes)),