Azure ad b2c 登录回调失败w/500,如何调试原因
我们有一个应用程序在四个环境中运行,其中四分之三的环境按预期工作。我们认为不需要更改代码,而是Azure环境、B2C设置或应用程序中的某种类型的配置导致了问题。仔细研究后,我们看到/signon oidc的回调接收到一个302 Not found,但位置设置为应用程序错误处理程序。fiddler对signin oidc的响应片段如下所示。其他环境中的位置是应用程序的完全限定应用程序url。如何从B2C确定此位置 找到HTTP/1.1 302 位置:/Home/Error 有哪些选项可用于增加此类故障的日志信息?重定向回调错误地设置了重定向的位置。但这是如何以及在哪里确定的 startup.cs-配置服务Azure ad b2c 登录回调失败w/500,如何调试原因,azure-ad-b2c,.net-core-2.2,Azure Ad B2c,.net Core 2.2,我们有一个应用程序在四个环境中运行,其中四分之三的环境按预期工作。我们认为不需要更改代码,而是Azure环境、B2C设置或应用程序中的某种类型的配置导致了问题。仔细研究后,我们看到/signon oidc的回调接收到一个302 Not found,但位置设置为应用程序错误处理程序。fiddler对signin oidc的响应片段如下所示。其他环境中的位置是应用程序的完全限定应用程序url。如何从B2C确定此位置 找到HTTP/1.1 302 位置:/Home/Error 有哪些选项可用于增加此类
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddAzureAd(options =>
{
Configuration.Bind("AzureAd", options);
options.ContentEditorClientKey = Configuration["AzureAd:WebPortalAzureAdKey"];
....
AzureAdOptions.Settings = options;
})
.AddAzureAdB2C(options => Configuration.Bind($"ContentEditor{nameof(AzureAdB2COptions)}", options))
.AddCookie(options =>
{
if (!string.IsNullOrEmpty(cookiedomain))
options.Cookie.Domain = cookiedomain;
});
startup.cs-配置
....
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseSession();
app.UseAuthentication();
app.UseMvc(routes =>
....
小提琴手
Fiddler-从B2C登录到/登录oidc的xml响应片段
Fiddler-符号oidc响应的位置错误
显示应用程序错误
我们已经非常仔细地查看了重定向URL、cookies、WAF环境等,但无法确定为什么signin oidc中的位置设置为错误的值。我可以在B2C和/或web应用程序(.Net core 2.2)中添加哪些日志记录?或者,如何设置位置值 你好@user2503078。如果身份验证中间件无法处理来自Azure AD B2C的身份验证响应,则ASP.NET核心日志应包含异常消息。任何未处理的异常都将重定向到
/Home/Error
。第4帧请求的“web表单”中有什么内容?@JasSuri,在/signin-oidc的请求中没有显示web表单属性。第3帧的XML响应中有什么内容?你看到那里的代币了吗?它应该在框架4中为你的应用程序添加一个隐藏的表单帖子。嗨@JasSuri,我在原始帖子中添加了我认为你需要的内容,请参阅“Fiddler-xml对signin oidc的响应”。表单操作值看起来是正确的。XML中还有什么我应该看的吗?