我试图在IS4和https://ocelot.readthedocs.io/en/latest/features/authentication.html之后使用Ocelot
在使用时
public void ConfigureServices(IServiceCollection services)
{
var authenticationProviderKey = "TestKey";
services.AddAuthentication()
.AddJwtBearer(authenticationProviderKey, x =>
{
});
}如果在TestKey中使用“ocelot.json”,则在启动应用程序时会引发一个错误。
无法启动Ocelot,错误有: TestKey,AllowedScopes:[]是不支持的身份验证提供程序
你知道怎么回事吗?我需要在我的IdentityServer应用程序中设置一些特别的东西吗?
发布于 2020-02-14 15:57:45
您需要添加以下选项,例如:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
// base-address of your identityserver
options.Authority = "https://demo.identityserver.io";
// name of the API resource
options.Audience = "api1";
});更多信息请访问:http://docs.identityserver.io/en/latest/topics/apis.html#
您还需要将API资源添加到标识服务器中:
new ApiResource("api1", "Some API 1")请参见:
http://docs.identityserver.io/en/latest/topics/resources.html和resource.html#refapiresource
https://stackoverflow.com/questions/54067154
复制相似问题