C# 标识服务器获取“错误”:“无效的\u作用域”
尝试获取自定义范围值的令牌时出错。下面是我的代码段C# 标识服务器获取“错误”:“无效的\u作用域”,c#,asp.net-core,identityserver4,C#,Asp.net Core,Identityserver4,尝试获取自定义范围值的令牌时出错。下面是我的代码段 public static IEnumerable<ApiResource> GetApis() => new List<ApiResource> { new ApiResource("ApiOne","ApiOne",new []{ "ApiOne"}) }; public sta
public static IEnumerable<ApiResource> GetApis() =>
new List<ApiResource>
{
new ApiResource("ApiOne","ApiOne",new []{ "ApiOne"})
};
public static IEnumerable<Client> GetClients() =>
new List<Client> { new Client
{
ClientId="client1",
ClientSecrets={ new Secret("secret1".Sha256())},
AllowedGrantTypes={GrantType.ClientCredentials},
AllowedScopes={"ApiOne"},
AllowOfflineAccess=true,
},
};
在配置中添加ApiScope
public static List<ApiScope> Get()
{
return new List<ApiScope>
{
new ApiScope
{
Name = "ApiOne",
Emphasize=true,
},
new ApiScope
{
Name = "ApiTwo",
Emphasize=true,
},
};
}
在配置中添加ApiScope
public static List<ApiScope> Get()
{
return new List<ApiScope>
{
new ApiScope
{
Name = "ApiOne",
Emphasize=true,
},
new ApiScope
{
Name = "ApiTwo",
Emphasize=true,
},
};
}
你的客户端配置是什么?你在定义API的作用域吗?你的客户端配置是什么?你在定义API的作用域吗?