I would like to add an authentication mechanism to my AngularJS app with Firebase backend. The requirements are simple:
- Authenticated users should be able to access any page.
- If unauthenticated users goes to
/some_page
(any page except/login
), they should be redirected to/login
. Once they enter the right credentials, they should be redirected to back to/other_page
.
Possible solution that is described here makes the following assumption:
My solution assumes the following server side behaviour: for every /resources/* call, if user is not authorized, response a 401 status
But, I'm not sure if it is possible to enforce this behavior when using Firebase as a backend.
Any help and/or examples to implement such AngularJS+Firebase integration will be appreciated!