Identity Server 4 同意屏幕从不显示
Identity Server 4 Consent Screen Never Shows
我正在尝试让 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" }
}
该项目包含同意屏幕的控制器和视图,但是我无法加载它。如果需要,我可以显示 类 或同意意见。
有谁知道如何配置 IdentityServer4 以显示同意屏幕?
您可以在注册 OpenIDConnect 方案时通过设置提示 属性 强制始终在客户端显示同意屏幕:
.AddOpenIdConnect(options =>
{
options.Authority = "https://localhost:6001";
options.ClientId = "xxx";
options.ClientSecret = "xxxx";
options.ResponseType = "code";
...
options.Prompt = "consent";
});
也许 Identity Server 正在记住您之前的同意。只需将此添加到客户端选项(默认值为 true
):
AllowRememberConsent = false,
我正在尝试让 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" }
}
该项目包含同意屏幕的控制器和视图,但是我无法加载它。如果需要,我可以显示 类 或同意意见。
有谁知道如何配置 IdentityServer4 以显示同意屏幕?
您可以在注册 OpenIDConnect 方案时通过设置提示 属性 强制始终在客户端显示同意屏幕:
.AddOpenIdConnect(options =>
{
options.Authority = "https://localhost:6001";
options.ClientId = "xxx";
options.ClientSecret = "xxxx";
options.ResponseType = "code";
...
options.Prompt = "consent";
});
也许 Identity Server 正在记住您之前的同意。只需将此添加到客户端选项(默认值为 true
):
AllowRememberConsent = false,