小编laz*_*nie的帖子

msal.js angular 6 SPA回调和错误处理

我在有角度的6 SPA上使用msal.js来处理身份验证时,遇到了一些问题:首先,我找不到关于如何处理lib错误的清晰示例,因此我左右选择了东西,然后到达到下一个结果:

@Injectable()
export class AuthenticationService {
_clientApplication: Msal.UserAgentApplication;
_clientApplicationPR: Msal.UserAgentApplication;
private _authority: string;

constructor(private apiService: ApiService, private backendRoutes: BackendRoutes) {
    this._authority = `https://login.microsoftonline.com/tfp/${environment.tenant}/${environment.signUpSignInPolicy}`;

    this._clientApplication =
        new Msal.UserAgentApplication(
            environment.clientID,
            this._authority,
            this._authCallback,
            {
                cacheLocation: 'localStorage',
                redirectUri: window.location.origin
            });
}

private _authCallback(errorDesc: any, token: any, error: any, tokenType: 
any) {
    console.log("in call back");
    if (token) {
        this.addUser();
    } else {
        // console.log(`${error} - ${errorDesc}`);
         if (errorDesc.indexOf("AADB2C90118") > -1) {
            //Forgotten password
            this._clientApplicationPR = new Msal.UserAgentApplication(
                environment.clientID,
                `https://login.microsoftonline.com/tfp/${environment.tenant}/${environment.passResetPolicy}`,
                this._authCallback,
                {
                    cacheLocation: 'localStorage',
                    redirectUri: …
Run Code Online (Sandbox Code Playgroud)

azure-active-directory azure-ad-msal angular msal.js

6
推荐指数
1
解决办法
477
查看次数

Chrome 调试器/断点停在错误的行

从 0.47 版本开始,我在 chrome 开发工具中的断点技术上会停在正确的行,但它在源代码面板上以其他方式显示。实际断点和蓝色选定行之间总会有 1 或 2 行偏移。这使得调试非常困难,因为它从未显示正确,有人听说过解决方案吗?

if(true){
  this.anyfunction();
  debugger;
  var toto = 10;
  toto ++;
}
Run Code Online (Sandbox Code Playgroud)

在此示例中,源代码中第一个选定的蓝线将是 toto++,而如果您在 toto 上添加手表,则 toto 将是未定义的,这就是为什么我假设断点已正确命中,但存在显示问题......

google-chrome breakpoints google-chrome-devtools

5
推荐指数
1
解决办法
3178
查看次数