IS4:请求对于应用程序的“userAudience”配置无效

Far*_*rid 5 c# azure asp.net-core identityserver4 microsoft-graph-api

我正在尝试在 IdentityServer4 中使用外部登录提供程序。我按照快速入门操作,一切正常,现在我正在尝试添加 Microsoft 登录。

我在 IS4 的启动中添加了这段代码:

services.AddAuthentication()
        .AddMicrosoftAccount(o =>
        {
            o.SignInScheme = IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme;
            o.ClientId = "yadayada";
            o.ClientSecret = "yoyoyoyo";
        });
Run Code Online (Sandbox Code Playgroud)

在 Azure 门户中,我定义了范围:

  • 开放ID
  • 轮廓

输入我的 Microsoft 用户名/密码后收到此错误:

异常: invalid_request;Description=该请求对于应用程序的“userAudience”配置无效。为了使用 /common/ 端点,应用程序不得配置为“消费者”作为用户受众。userAudience 应配置为“全部”才能使用 /common/ 端点。

异常:处理远程登录时遇到错误。 Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync() IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.HandleRequestAsync() Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext 上下文) IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext 上下文) Microsoft.AspNetCore。 Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext 上下文)

编辑: 这是 Asp.NET Core 中的一个错误。在这里跟踪: https ://github.com/dotnet/AspNetCore.Docs/issues/19795

Cas*_*sio 4

我遇到了同样的错误。我可以通过重新创建应用程序注册并选择支持的帐户类型来修复它:

  • 任何组织目录中的帐户和个人 Microsoft 帐户。