Implementing a login and user authentication system for your AngularJS app seems to be one of the hardest problems people encounter. My article on a simple login with Ionic and AngularJS is the far most viewed article on this blog, every day! As the mentioned article only describes a basic system for a very low level security, this article will highlighteverything you need for a complete user authentication and login inside your AngularJS app!
In particular this means, this article will show you how to:
- Log in a user and store the user session (Token based auth!)
- Protect your routes based on authentication status and role of the user
- Notice when an unauthorised request was made and a new login is required