问题描述
我目前正在使用 Roundcube 的 1.5 版本并尝试将其配置为与 Yahoo 邮件服务器一起使用。我已经创建了一个应用程序,并且还允许来自 OpenID 的电子邮件和个人资料 API 权限。 范围存在问题,当尝试登录时,它重定向回错误页面并说:“请从注册范围请求范围并再次提交”。 这是 Roundcube 的当前配置:
// Enable OAuth2 by defining a provider. Use 'generic' here
$config['oauth_provider'] = 'yahoo';
// Provider name to be displayed on the login button
$config['oauth_provider_name'] = 'Yahoo';
// Mandatory: OAuth client ID for your Roundcube installation
$config['oauth_client_id'] = '------';
// Mandatory: OAuth client secret
$config['oauth_client_secret'] = '------';
// Mandatory: URI for OAuth user authentication (redirect)
$config['oauth_auth_uri'] = 'https://api.login.yahoo.com/oauth2/request_auth';
// Mandatory: Endpoint for OAuth authentication requests (server-to-server)
$config['oauth_token_uri'] = 'https://api.login.yahoo.com/oauth2/get_token';
// Optional: Endpoint to query user identity if not provided in auth response
//$config['oauth_identity_uri'] = 'null';
// Optional: disable SSL certificate check on HTTP requests to OAuth server
// See http://docs.guzzlePHP.org/en/stable/request-options.html#verify for possible values
$config['oauth_verify_peer'] = true;
// Mandatory: OAuth scopes to request (space-separated string)
$config['oauth_scope'] = 'openid mail-r mail-w sdct-w';
// Optional: additional query parameters to send with login request (hash array)
$config['oauth_auth_parameters'] = ['nonce' => mt_rand(),'prompt' => 'consent'];
// Optional: array of field names used to resolve the username within the identity information
$config['oauth_identity_fields'] = null;
// Boolean: automatically redirect to OAuth login when opening Roundcube without a valid session
$config['oauth_login_redirect'] = true;
以下是该应用的设置: https://imgur.com/pwtNsvx
错误:
解决方法
您需要先请求访问受限范围。一旦获得批准,您需要创建一个应用程序并选择邮件范围(电子邮件范围是为了访问用户的“电子邮件”身份,而不是访问邮箱)。见https://developer.verizonmedia.com/mail