1

Our application is developed in angularjs and C#.I was using ADAL.js for azure ad login. As it is deprecating, we are migrating into MSALjs . I have removed all references of ADAL and replaced it with MSALand MSAL config is as below

authority: "https://login.microsoftonline.com/common",
                clientID: AppClientId,
                redirectUri: "http://localhost:8080/#/home",
                postLogoutRedirectUri: logoutredirecURL,
                navigateToLoginRequestUrl: true,
                optionalParams: {
                    protectedResourceMap: GetEndPoints()
                },
                tokenReceivedCallback: function (errorDesc, token, error, tokenType) {
                    console.log('token : ' + token);
                    localStorage.setItem('Authorization', 'Bearer ' + token);
                }

I am able to redirect to LOgin URL of azure and after input of credential the isAuthorized is also true. While sending the request to server the below code

HttpActionContext.ControllerContext.RequestContext.Principal.IsAuthenticated

This isAuthenticated is getting false, in ADAL it was getting true . I dont know where I am getting wrong.

PrincipalClaims are not getting fetched of User.

Please help and Thanks in Advance

Jumbo
  • 35
  • 8
  • Hello Hari, I have used MSAL.js and used the above config in it , and the error I am facing is in Authentication. – Jumbo Oct 13 '20 at 07:46
  • Did you solve the problem, are you still looking for help? – Carl Zhao Oct 16 '20 at 09:54
  • Nope, Problem not solve but came to some analysis like ADAL.js config is similar to MSAL.js (1.xx) but there is a lot of difference in MSAL.js (2.xx) .There is different config and flow. Msal 1.X.X – This implements the implicit flow of OAuth and targets the v2 endpoint. It almost identical of Adal.js. Msal-browser 2.X.X – This library implements the code grant flow with PKC and this is latest version of the Msal but there is no sample of Angular.jsfound – Jumbo Oct 21 '20 at 09:49
  • Hi @Jumbo, You can find the implementation of Pkce flow of MSAL.js [here](https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-javascript-auth-code#how-the-tutorial-app-works). – Hari Krishna Oct 23 '20 at 10:12

1 Answers1

0

You can find the implementation of Pkce flow of MSAL.js which can help you in your development here.

Hari Krishna
  • 2,372
  • 2
  • 11
  • 24