Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User data is being loaded too late in some cases #23

Open
alexchiraples opened this issue Jul 28, 2017 · 0 comments
Open

User data is being loaded too late in some cases #23

alexchiraples opened this issue Jul 28, 2017 · 0 comments

Comments

@alexchiraples
Copy link
Contributor


Migrated from https://github.com/gov-ithub/auth-sso/issues/112
Originally created by @aoancea on Mon, 30 Jan 2017 18:38:53 GMT


As we are loading the user information through angular's MainController, this happens in an ajax call which might end up finishing after other views have already been loaded.

This is causing some issues as the currently $scope.currentUser will be loaded too late in the process.

A specific scenario for testing would be to stop the application and start it on the following url #/index/users. Other subsequent refreshes on the page will somehow work.

Possible solutions

  • Store the user data in the browser.
  • When angular runs, inside the run block, check to see if user data is already loaded. If it is, continue with the requested page. If it's not, send to the login page.

Local storage

Pros

  • User can open new tabs, windows, close and re-open tabs and windows and he will still be logged in

Cons

  • This requires expiration management. It can be countered by using refresh tokens

Session storage

Pros

  • Does not require expiration management

Cons

  • Each time you open a new tab, new window, close and re-open tab or window, the User will have to re-authenticate which is very annoying

I would opt in for Local storage and by handling the expiration manually since we have authentication + authorization handled on the server as well and this information is not likely to change very often.

Keep in mind

  • user data should encapsulate all information from a user which is required in the browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant