Identity Server 4 同意屏幕从不显示

joh*_*y 5 5 authentication asp.net-core identityserver4

我试图从Identity Server 4 Samples中显示同意屏幕,我已经配置了客户端,因此它需要同意,如下所示:

new Client
{
    ClientId = "openIdConnectClient",
    ClientName = "Example Implicit Client Application",
    AllowedGrantTypes = GrantTypes.Implicit,
    RequireConsent = true,
    AllowedScopes = new List<string>
    {
        IdentityServerConstants.StandardScopes.OpenId,
        IdentityServerConstants.StandardScopes.Profile,
        IdentityServerConstants.StandardScopes.Email,
        "role",
        "customAPI"
     },
     RedirectUris = new List<string> {"https://localhost:44330/signin-oidc"},
     PostLogoutRedirectUris = new List<string> { "https://localhost:44330" }
 }
Run Code Online (Sandbox Code Playgroud)

该项目包含同意屏幕的控制器和视图,但是我无法加载它。如果需要,我可以显示同意的类或视图。

有谁知道如何配置 IdentityServer4 显示同意屏幕?

And*_*ndy 4

您可以在注册 OpenIDConnect 方案时通过设置 Prompt 属性来强制同意屏幕始终显示在客户端中:

.AddOpenIdConnect(options =>
        {
            options.Authority = "https://localhost:6001";
            options.ClientId = "xxx";
            options.ClientSecret = "xxxx";
            options.ResponseType = "code";
       
            ...

            options.Prompt = "consent";
        });
Run Code Online (Sandbox Code Playgroud)