ASP.NETCore3.1网站中的OpenIdDict3.0错误
创始人
2024-09-17 10:00:54
0

一种可能的解决方法是在Startup.cs中将OpenIdDict的配置属性设置为默认值。以下是示例代码:

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllersWithViews();

    services.AddDbContext(options =>
        options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

    services.AddIdentity()
        .AddEntityFrameworkStores()
        .AddDefaultTokenProviders();

    services.AddAuthentication(options =>
    {
        options.DefaultScheme = OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme;
        options.DefaultSignInScheme = OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme;
    })
    .AddJwtBearer(options =>
    {
        options.Authority = Configuration["Authentication:JwtIssuer"];
        options.TokenValidationParameters = new TokenValidationParameters
        {
            ValidateIssuer = true,
            ValidateAudience = false,
            ValidateLifetime = true,
            IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(Configuration["Authentication:JwtKey"])),
            ClockSkew = TimeSpan.Zero
        };
    });
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    [...]

    app.UseAuthentication();
    app.UseAuthorization();

    app.UseOpenIddict();
}

此外,还应该确保在项目文件中添加OpenIdDict的引用,如下所示:



如果问题仍然存在,请查看OpenIdDict和ASP.NET Core的文档,以获得更多的解决方案和支持。

相关内容

热门资讯

透视好友!wpk官网下载链接,... 透视好友!wpk官网下载链接,佛手在线大菠萝智能辅助器,积累教程(一直有挂)-哔哩哔哩1、佛手在线大...
透视线上!aapoker怎么选... 透视线上!aapoker怎么选牌(透视)开挂辅助神器(好像存在有挂)-哔哩哔哩1、aapoker怎么...
透视透视!HH平台挂,aapo... 透视透视!HH平台挂,aapoker透视脚本,指南教程(确实存在有挂)-哔哩哔哩1)aapoker透...
透视安卓版本!wepoker俱... 透视安卓版本!wepoker俱乐部辅助(透视)开挂辅助插件(确实真的有挂)-哔哩哔哩1.wepoke...
透视规律!德普辅助器怎么用,w... 透视规律!德普辅助器怎么用,wepokerplus到底是挂了吗,总结教程(一直存在有挂)-哔哩哔哩1...
透视黑科技!wepoker破解... 透视黑科技!wepoker破解器,有没有人wepoker,指引教程(原来真的是有挂)-哔哩哔哩1、有...
透视规律!wepoker怎么买... 透视规律!wepoker怎么买辅助(透视)开挂辅助插件(真是真的是有挂)-哔哩哔哩运wepoker怎...
透视规律!wepoker辅助器... 透视规律!wepoker辅助器免费,we poker辅助器下载,指引教程(都是有挂)-哔哩哔哩暗藏猫...
透视开发!aa poker透视... 透视开发!aa poker透视软件(透视)开挂辅助攻略(竟然存在有挂)-哔哩哔哩所有人都在同一条线上...
透视神器!wepokerh5破... 透视神器!wepokerh5破解,wepoker怎么下载游戏,窍要教程(总是是真的挂)-哔哩哔哩1、...