首页 > 解决方案 > 如果有任何错误,我正在尝试重新验证

问题描述

我在“MSAL”中尝试“acquiresilenttoken”时遇到错误,但我无法执行“handleRedirectCallback”。我尝试添加一个调试器,但它永远不会进入“handleRedirectCallback”,这可能是什么原因。下面是我正在使用的代码。

if (err ) {
                                    //this.authService.logout();
                                    debugger

                                    this.authService.handleRedirectCallback((err:AuthError) => {
                                        debugger
                                        if (err) {

                                          console.error('Redirect Error: ', err.errorMessage);
                                          return;
                                        }
                                        debugger
                                        this.authService.loginRedirect();
                                        console.log('Redirect Success: ');
                                      });
                                    this.broadcastService.broadcast('msal:notAuthorized', err.message);
                                }

我的 MSAL 配置:

"auth": {
        "clientId": "xxx",
        "authority": "https://login.microsoftonline.com/xxx",
              "validateAuthority":"true",

              "postLogoutRedirectUri": "http://localhost:44399/",
              "navigateToLoginRequestUrl": true
    },
    "system":{
        "loadFrameTimeout":10000
    },
    "cache": {
      "cacheLocation": "localStorage"

    }

标签: angularazureangular8msal

解决方案


推荐阅读