【发布时间】:2017-11-19 17:37:39
【问题描述】:
我正在尝试使用 Microsoft 帐户作为 IdentityServer4 中的外部登录,我在 Microsoft 应用程序门户下创建了一个新应用程序并将其配置如下:
- 我添加了新的网络平台
- 在委派权限下我添加了以下权限
- User.Read
- 电子邮件
- openId
- 简介
这是我在 IdentityServer4 中使用的代码,通过添加电子邮件作为范围来访问 Microsoft 帐户:
services.AddAuthentication()
.AddMicrosoftAccount("MicrosoftAccount", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.ClientId = "ClientId";
options.ClientSecret = "ClientSecret";
options.Scope.Add("email");
});
但在尝试访问 Microsoft 帐户时出现以下错误
为输入参数“范围”提供的值无效。范围https://graph.microsoft.com/user.read 电子邮件无效
【问题讨论】:
标签: c# asp.net-core identityserver4