Microsoft-adal -angular6 working only after refresh in angular 6

331 Views Asked by At

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

There are 1 best solutions below

0
Harun On

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