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

基于Chromium浏览器的MSAL库令牌解析失败问题(非ASCII字符场景)

MSAL/Azure认证:含特殊非ASCII字符的令牌在Chromium浏览器解析失败问题

我们遇到了MSAL库或Azure认证的异常问题:当令牌中的Given Name和Family Name属性包含ž、č、Č、Ž这类非ASCII字符时,基于Chromium的浏览器无法解析令牌,但此类用户在Firefox中可正常登录。奇怪的是,部分含非ASCII字符的用户在所有浏览器中均无此问题。

Angular中的MSAL初始化代码

// Authentication is executed in APP_INIT
function msalInitialize(msal: MsalService): Observable<boolean | void> {
  return msal.initialize().pipe(
    switchMap(() => msal.handleRedirectObservable()),
    // Check redirectResult to prevent login loop
    switchMap((redirectResult) => {
      if (redirectResult) {
        const msalInstance = msal.instance;

        const allAccounts = msalInstance.getAllAccounts();
        msalInstance.setActiveAccount(allAccounts[0]);

        return of(true);
      } else {
        const request: RedirectRequest = {
          scopes: environment.auth.scopes
        };
        return msal.loginRedirect(request);
      }
    }),
    catchError((e) => {
      console.log('MSAL Error:', e);
      // Authentication is hidden beneath a splash screen and that's how we communicate with it
      send(APP_LOADING_STATE.APP_AUTHENTICATION_FAILURE);
      throw new Error(APP_LOADING_STATE.APP_AUTHENTICATION_FAILURE);
    })
  );
}

当前状态与排查方向

由于业务不使用这两个属性,已通过移除Given Name和Family Name属性临时解决问题,但仍想排查根本原因,当前推测方向如下:

  • Azure配置:由客户管理,我方无权限查看,需协同排查
  • MSAL配置:实例化库时的相关设置,但暂未找到对应项
  • JS引擎差异:暂无解决思路

请问是否有人遇到过同类问题?若有,是如何解决的?

内容的提问来源于stack exchange,提问作者mat.hudak

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 15:09:54