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

Azure AD B2C Redirect URI仅localhost可用,生产环境URI无法正常工作的问题求助

Azure AD B2C Redirect URI仅localhost可用,生产环境URI无法正常工作的问题求助

大家好,我最近在Blazor应用对接Azure AD B2C时遇到了一个头疼的问题,想请各位帮忙排查下:

当我把重定向URI设为http://localhost时,本地运行完全正常,认证流程能顺利走通。但换成生产环境要用的https://medbase.co.zw/auth后,就彻底失效了——连PublicClientApplicationBuilder这段初始化代码都没执行,可切回localhost测试时,这部分代码又能正常跑起来。

下面是我的核心代码片段:

Scopes = _settings.Scopes.ToStringArray();
// Create PCA once. Make sure that all the config parameters below are passed
PCA = PublicClientApplicationBuilder
                            .Create(_settings?.ClientId)
                            .WithB2CAuthority(_settings?.Authority)
#if !ANDROID
                            .WithRedirectUri("https://medbase.co.zw/auth")
                            //.WithRedirectUri("http://localhost")
#endif
                            .Build();

我也确认过Azure AD B2C应用配置里已经添加了生产环境的重定向URI,附上配置截图供参考:
Azure AD B2C重定向URI配置截图

有没有朋友遇到过类似的情况?或者能给我一些排查的方向?万分感谢!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.17 10:04:33