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

问题描述 投票:0回答:3

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

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

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

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

  • openid
  • 简介

输入我的 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

c# azure asp.net-core microsoft-graph-api identityserver4
3个回答
2
投票

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

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

0
投票

您只需转到门户 Azure 面板,打开清单部分,然后将

signInAudience
的值从
PersonalMicrosoftAccount
更改为
AzureADandPersonalMicrosoftAccount
。如果不存在,请创建键和值。


0
投票

转到 Portal.azure.com 上应用程序侧栏中的清单部分,将 JSON 中的 "signInAudience": "PersonalMicrosoftAccount" 值更改为 "signInAudience": "AzureADandPersonalMicrosoftAccount" 并保存。

© www.soinside.com 2019 - 2024. All rights reserved.