我正在尝试验证Azure Functions v2。我正在进入error Microsoft.AspNetCore.Authentication.Core: No authentication handler is registered for the scheme 'WebJobsAuthLevel'. The registered schemes are: Bearer. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("WebJobsAuthLevel",...)?.
下方
下面是我在Startup.cs中使用的代码
public class Startup : IWebJobsStartup
{
public void Configure(IWebJobsBuilder builder)
{
builder.Services.AddAuthentication()
.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme,o =>
{
o.Audience = "https://*******************.azurewebsites.net/";
o.Authority = "http://localhost:****";
o.RequireHttpsMetadata = false;
o.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
{
RequireSignedTokens = true,
ValidAudience = "https://***************.azurewebsites.net/",
ValidateAudience = true,
ValidIssuer = "https://sts.windows.net/***************-5********2**/",
ValidateIssuer = true,
ValidateIssuerSigningKey = true,
ValidateLifetime = true
};
});
}
}
更改了代码,但仍收到相同的给定错误。我漏掉了哪一个?
https://stackoverflow.com/questions/56463935
复制相似问题