Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting access token when the page loads for the very first time after logging into the angular app using MSAL #14

Open
SujitGodavarti opened this issue Jan 18, 2018 · 0 comments

Comments

@SujitGodavarti
Copy link

I am using MSAL in my angular app for authentication purpose. To start off, I used this application as demo app with my tenant I created in azure. After I login, before I make an API call, I am successfully able to get the access token without any issue for the this app.

Now I am following the same approach and trying to integrate this into my actual angular app. I also enabled logging as mentioned below.

https://github.com/spottedmahn/NetCoreAngularAzureB2CMsal/blob/error-debugging/ClientApp/app/services/authentication.service.ts

I am able to successfully login into the app. After logging in, when I am trying to load the page with the API call for the very first time, I get an error 'User login is required' and there is no 'user' in the 'this.clientapplication' which I am logging in console as shown in below image.

img1

But when I refresh the page that has the API call, I am able to get the token without error and the 'user' which was missing in the first case, is there after the refresh as shown in the image below.

img2

I am unable to figure out what I am missing when the page loads for the very first time. Please help me solve this issue.

@SujitGodavarti SujitGodavarti changed the title Error getting access token after logging into the angular app using MSAL Error getting access token when the page loads for the very first time after logging into the angular app using MSAL Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant