You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ASP.NET Core 8/Angular 17环境下OAuth认证适配新Angular代理的问题咨询

ASP.NET Core 8/Angular 17环境下OAuth认证适配新Angular代理的问题咨询

各位大佬好,想请教个棘手的问题:我们之前在“legacy”的ASP.NET Core/Angular项目里一直用OAuth认证,运行得好好的,但升级到ASP.NET Core 8+Angular 17之后,配合新的Angular代理代码,这套认证突然失效了。

下面是我们在Startup的ConfigureServices/Configure里配置认证的核心代码片段:

builder.Services.AddAuthentication(sharedOptions =>
{
   sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
   sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
   options.ExpireTimeSpan = TimeSpan.FromHours(10); //default is 14days
   options.SlidingExpiration = true;
   options.AccessDeniedPath = "/UserAccessDenied";
})
.AddOpenIdConnect(options =>
{
   options.Authority = builder.Configuration["Auth:Authority"];
   options.ClientId = builder.Configuration["Auth:ClientId"];
   options.ResponseType = OpenIdConnectResponseType.Code;
   options.UsePkce = true;
   options.GetClaimsFromUserInfoEndpoint = true;
   // 其余配置项未完全列出,核心配置逻辑如上
});

目前的问题是,新的Angular代理似乎没有正确转发认证相关的请求,导致OAuth流程直接卡壳。有没有大佬遇到过类似的适配问题?或者能给点排查思路和解决方向?

备注:内容来源于stack exchange,提问作者awdorrin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 08:29:50