Questions tagged [angularjs-authentication]
15 questions
133
votes
10 answers
AngularJS- Login and Authentication in each route and controller
I have an AngularJS application created by using yeoman, grunt and bower.
I have a login page that has a controller that checks for authentication. If the credentials are correct I reroute to home page.
app.js
'use strict';
//Define Routing for…

iCode
- 8,892
- 21
- 57
- 91
68
votes
4 answers
Authentication with AngularJS, session management and security issues with REST Api WS
I started developing a web-app with angularJS and I'm not sure that everything is right secured (client and server side).
Security is based on a single login page, if credentials are checked ok, my server sends back an unique token with custom…

StarsSky
- 6,721
- 6
- 38
- 63
17
votes
5 answers
AngularJS | handle routing before they load
I wish to create a simple authentication check for my routes by external service.
I define the access requirements on the route object:
$routeProvider
.when('/', {
templateUrl: 'src/app/views/index.html',
controller:…

Almog Baku
- 810
- 1
- 9
- 22
17
votes
1 answer
Redirect after user has logged in
I'm pretty new to Angular, and right now I'm just trying to get all my routes set up and working as I'd like.
Setup:
When a user navigates to certain pages (/settings for this example) the app should check if there is a user already logged in. If…

Lucy Bain
- 2,496
- 7
- 30
- 45
6
votes
4 answers
locationChangeStart and preventing route change
I'm trying to create basic validation whether user can access some route or not.
I had progress in that, but there's one thing that I can't figure out.
I'm using $locationChangeStart to monitor route changes. Scenario is:
1. if user is logged in,…

Ned
- 3,961
- 8
- 31
- 49
4
votes
3 answers
AngularJS and Firebase Authentication
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),…

Misha Moroshko
- 166,356
- 226
- 505
- 746
2
votes
0 answers
Angular login auth what about using web worker?
What do you think about this approach
using web worker for angular login/auth
it looks good at me and in this way you can get rid of
$rootScope event as well :)
This is just an example in a more prodution way
you should use like…

Whisher
- 31,320
- 32
- 120
- 201
2
votes
1 answer
Angular $http useCredentials return error
I am trying to build an AngularJS frontend for a Drupal 7 website.
The problem is that, when I set useCredentails to true, I get this error.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at…

Muhammad Reda
- 26,379
- 14
- 93
- 105
2
votes
3 answers
AngularJS: How to hide the template content until user is authenticated?
My app has 2 pages: main.html and login.html.
When not authenticated users go to /main they should be redirected to /login.
The problem is that main.html is rendered first, and after a second or so, when user authentication fails, login.html is…

Misha Moroshko
- 166,356
- 226
- 505
- 746
1
vote
1 answer
Angular ui-router, possible to resolve an authentication check before other resolves?
When using the resolves in ui-router, is it possible to have something resolve first (an authentication check for example) before the other resolves on a state are even started?
This is an example of how I'm doing my authentication check right…

JDWardle
- 913
- 1
- 10
- 16
1
vote
1 answer
When setting http authorization headers the AngularJS app crashes
I want to make a request to the twitter api and get the current logged in userfeed.
I tryed the twitter api with "apigee" and everything works fine. Even when copying the Authorization header from "apigee" into "postman" I get back data.
Well but…

kevj
- 55
- 1
- 8
0
votes
1 answer
Opening link in new browser redirecting me to login page in Angular JS
I have AngularJS website which contains few hyperlink. Whenever I try to open the link in same tab then it is working fine but whenever I try to open the link in new tab then it is redirecting me to login page.
RouteController.js
var app =…

simple user
- 349
- 3
- 22
- 44
0
votes
7 answers
How to disable users from accessing previous page by browser back button after logout in angularjs application?
I have an angularjs web application. I am trying not to allow users to go to previous page using browser back button after logout. I wish to show users a messge like "Please login to continue". I am unable to get any ideas. Please suggest.

pratham gn
- 95
- 1
- 4
- 14
0
votes
2 answers
AngularJS - after logging in and close tab, it is not redirecting to home
I have created a angularJS application with yeoman, grunt and bower. I have tried a simple login example. After loggin in, it will goto home page. And for any route changes it will check for whether the user is logged in or not. If logged in, it…

Coder
- 6,948
- 13
- 56
- 86
0
votes
1 answer
angularjs interceptor $broadcast doesn't work
I'm playing around with the code of
http://ngmodules.org/modules/http-auth-interceptor
and I'm wondering why
$rootScope.$broadcast('loginRequired');
doesn't trigger the alert in the controller
$scope.$on('loginRequired',function() {
…

Whisher
- 31,320
- 32
- 120
- 201