【发布时间】:2021-03-08 11:56:32
【问题描述】:
我目前正在尝试将 Roundcube 配置为通过 OAuth 使用 Outlook 的 IMAP/SMTP。如果我不使用 Oauth,它似乎工作正常,但在尝试设置身份验证时,我在控制台中收到 CORB 错误。该应用程序可让您选择一个帐户并进入同意屏幕。但是,一旦我点击“是”表示同意,它就会重定向回 Roundcube 登录页面,而不是 Outlook 帐户内。我尝试了所有我能想到的东西,并且基本上在这一点上开始强制设置,所以我对问题可能是什么感到非常迷茫。任何意见将不胜感激。
这是我目前拥有的“default.inc.php”配置:
[$config\['oauth_provider'\] = 'outlook';
$config\['oauth_provider_name'\] = 'Outlook.com';
$config\['oauth_client_id'\] = "-||-||-";
$config\['oauth_client_secret'\] = "-||-||-";
$config\['oauth_auth_uri'\] = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
$config\['oauth_token_uri'\] = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
$config\['oauth_identity_uri'\] = "https://graph.microsoft.com/v1.0/me";
$config\['oauth_identity_fields'\] = null;
$config\['oauth_scope'\] = "https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send User.Read offline_access";
$config\['oauth_auth_parameters'\] = \['nonce' => mt_rand(), 'prompt' => 'consent'\];
$config\['oauth_login_redirect'\] = true;
$config\['oauth_verify_peer'\] = true;
// of IMAP host (no prefix or port) and SMTP server e.g. \['imap.example.com' => 'smtp.example.net'\]
$config\['smtp_server'\] = 'tls://smtp.office365.com';
// SMTP port. Use 25 for cleartext, 465 for Implicit TLS, or 587 for STARTTLS (default)
$config\['smtp_port'\] = 587;
$config\['default_host'\] = 'ssl://outlook.office365.com';
// TCP port used for IMAP connections
$config\['default_port'\] = 993;][1]
重定向回登录页面后控制台中显示的图片: https://i.stack.imgur.com/17YO3.png
来自 Mozilla 的错误: 资源来自“https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=1111111111&scope=https%3A%2F%2Foutlook.office.com%2FIMAP.AccessAsUser.All+https% 3A%2F%2Foutlook.office.com%2FSMTP.Send+User.Read+offline_access&redirect_uri=https%3A%2F%2Fsocialcloudwm.com%2Fwebmailoffice365%2Findex.php%2Flogin%2Foauth&state=pJFjCaPDvbNG&nonce=1971951749&prompt=consent”被阻止MIME 类型(“text/html”)不匹配(X-Content-Type-Options: nosniff)。
【问题讨论】: