AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 372 forks source link

URI params gets cleared #720

Closed tscislo closed 6 years ago

tscislo commented 6 years ago

I have some filtering parameters passed as URI params ?filterA=xxx&filterB=yyy, which when I copy and paste to new browser tabs gets cleared by adal-angular. When I disable adal-angular those URI params don't get cleared.

cobaltsoftware commented 6 years ago

What do you mean by "gets cleared by"?

tscislo commented 6 years ago

Here is the scenario

  1. I'm using adal-angular5 which uses adal-angular on SPA
  2. I log in on page: http://localhost:4200/something successfully
  3. I use app normally and navigate to http://localhost:4200/something?filter=A
  4. When I copy paste http://localhost:4200/something?filter=A to another tab I get authenticated properly as I should, because I have active session in this browser, however during a series of redirects query params such as filter=A gets removed and I'm landing on http://localhost:4200/something without filter=A
cobaltsoftware commented 6 years ago

I would check to make sure of a few things

  1. The token is being saved,
  2. Your token is passed to the server with EVERY request
  3. Your timeout has not expired.

Also remember, with SPA's, even updating part if the page requires the authorization token that was received at logon. And if the session is close to expiration, it has to be renewed before it expires.

rohitnarula7176 commented 6 years ago

@tscislo Url query params are not retained during redirection from AAD by design. This is is the reason we strip the query params from the login start page before redirecting the user to the authorization endpoint. Please see below: https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/beee84cb37d59b04f15e06140d3c3dc1d61cade9/lib/adal.js#L171 You will have to save the query params elsewhere and then reset the window.location after successful authentication.