0
votes

I am using microsoft-adal-angular6 for azure ad authentication in my angular 6 app. Currently when the app loads for the first time, it calls the api methods 2 times and i see my loading icon. But after i refresh the page, it works fine.

  1. Why is it working this way? what can be done to avoid this. I have already tried changing redirecturi to /redirect.html, but no luck.

  2. The same thing happens when i navigate from my main site to sub-site . After i navigate to sub-site, ill have to refresh to page to get the token working .

Thanks for your time and reply in advance. Any sample code in angular 2 or above would be very helpful.

1
Any sample code in angular 2 or above would be very helpful well I was gonig to say the same. Could you provide some code ? Some minimal reproducible example ? - user4676340
Will be uploding the code , but in the menawhile i would giv u the gist. I have defined adalconfig in environment.ts and using that adalconfig in msAdalAngular6ConfigFactory of app.module.ts. @Maryannah - Vinay Kumar
I found why it isn't displaying on first load- it is because the iframe that gets the token, loads app in its window which is hidden. When i changed the visibility of iframe i could see the data over there. Still not clue how to stop this behaviour. @Maryannah - Vinay Kumar

1 Answers

0
votes

This is because the azure authentication token expires every 1 hour. See my answer in the below link which may give you an idea.

Adal.js Token refresh issue in Angular