adal angular app reloading - by design?

Viewed 3936

I have built a simple angular app and for authentication, I authenticate against AzureAD using use the npm package adal-angular4

When authentication happens, the user gets sent to https://login.microsoftonline.com they login and get sent back to the agulare app which causes a reload/recompile which will cause a load time delay, only short but the overall load time experience is doubled.

network view

As you can see above :

  • login is loaded (localhost)
  • app is compiled
  • user taken to login screen (azuread)
  • user logs in and user is taken back to login (localhost)
  • app is complied

The load gap between main.bundle.js and background' is a simple way to show the compile time, its only a VERY TIME but I have a VERY FAST PC.

What can be done to avoid the recompile? My thoughts are

  • Do all the auth in the index.html (eg, pre first load of APP) and just save the JWT token to the session storage
  • Find an angular packages do this via an IFRAME

Anyone got any thoughts on this? maybe adal-angular4 should use an IFRAME?

Some more details

Example of adal-angular4

Microsofts anglurejs example which uses this javascrit maybe this is a good starting place for a pure JavaScript solutoon thats executed from the index.html.

2 Answers
Related