本篇文章为大家探讨IdentityServer4 授权配置AllowedScopes的方法的解决方法,文章内容质量较高,有需要的朋友可以学习和借鉴。

IdentityServer4 授权配置Client中的AllowedScopes,设置的是具体的 API 站点名字,也就是使用方设置的ApiName,示例代码:
//授权中心配置new Client
{
ClientId = "client_id_1",
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
AllowOfflineAccess = true,
AccessTokenLifetime = 3600 * 6, //6小时SlidingRefreshTokenLifetime = 1296000, //15天ClientSecrets =
{new Secret("secret".Sha256())
},
AllowedScopes =
{"api_name1"},
}//API 服务配置app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = $"http://localhost:5000",
ApiName = "api_name1",
RequireHttpsMetadata = false}); 
售后响应及时
7×24小时客服热线
数据备份
更安全、更高效、更稳定
价格公道精准
项目经理精准报价不弄虚作假
合作无风险
重合同讲信誉,无效全额退款