GIP-ITC-UniversityTwente / stars-webviewer

Web interface of the Visualization tool for STARS
0 stars 0 forks source link

Authentication & Load with app on Chrome and Safari #60

Closed ccabanero closed 6 years ago

ccabanero commented 7 years ago

User is required to perform one or more of the following to now enter the web app:

  1. clear web browser cache
  2. multiple log ins
  3. refreshing the browser

Confirm that this is not an artifact from the 'temporary deployment endpoint' that we were using while this issue was observed.

ccabanero commented 7 years ago

It has been tested and confirmed that this authentication workflow problem is not the deployment endpoint: https://stars.itc.nl/api/upgrade/webviewer.

Currently my understanding is the following:

  1. The app loads
  2. The app checks if the user is authenticated
  3. If not (cache is cleared or is literally the first login) the user is redirected to the Auth0 hosted login page.
  4. At the time the user is redirected, the app continues to request study areas and thus request fails because the user has not yet authenticated.
  5. After successful authentication, a token is saved to local storage, and the app re-directs to the STARS web page.
  6. The browser now has a JWT in local storage but the site has not 'recovered' from the previous/first request to study areas.
  7. If a user refreshes the STARS web viewer page after being redirected it works because now it has a JWT for the initial study areas and all requests thereafter.
lcalisto commented 6 years ago

Problem seems to have been fixed by removing window.location.hash = ''; from auth.service.ts and adding the login check in home component.