Refers to Angular's AuthenticationGuard class, a route protection mechanism most commonly implementing `canActivate`.
Questions tagged [auth-guard]
164 questions
3
votes
0 answers
programmatically trigger auth guard
Is it possible to trigger AuthGuard within a component?
The purpose for this is if some logic fails, then it triggers the AuthGuard where AuthGuard holds the logic to navigate user until they have completed the tasks given in that page.

roger
- 1,225
- 2
- 17
- 33
3
votes
1 answer
Why .map operator doesn't working without .pipe (Angular + Angularfire2/auth)?
I've implemented an Auth guard in one of the routes calling the authState method of AngularFireAuth.
I've seen plenty of example like the following to grant access:
return this.afAuth.authState.map(user => {
if(isNullOrUndefined(user)){
…

Nanex
- 39
- 3
3
votes
1 answer
Wait for two observables to finish in order in an Angular auth guard
Here's my Angular auth guard. It checks for a logged in status, then gets an id from it if it exists and checks for a profile assigned to that id.
I'm trying to resolve the guard waiting for this two observables to finish in order with the zip…

cerealex
- 1,649
- 4
- 17
- 37
2
votes
0 answers
AuthGuard security not working as expected
In Angular I have implemented JWT authentication.
While trying to implement AuthGuard security for role based authentication , it is not working
Here is my code..
Auth.guard.ts
import { Injectable } from '@angular/core';
import { Router,…

vandu
- 21
- 2
2
votes
0 answers
Angular AuthGuard - NgRx - Universal on reload redirection
The problem is with Angular Universal, if I build app without Universal It's working fine but with Angular Universal this is the problem.
I'm using angular with ngrx and Angular Universal, on every reload I'm sending request to the backend then…

Todor Pavlovic
- 160
- 1
- 11
2
votes
0 answers
CanActivate makes the navigation button to be clicked twice in order for the screen to change
I have this sign in method. when I try to the built in auth guard in my routing module, the sign in button needs to be clicked twice to be navigated to the next screen. But the console log string that i print shows up the first time. So it seems the…

Al Nafis
- 127
- 9
2
votes
1 answer
How to dynamically add authguard based on a role in Angular?
In my Angular app , Admin user creates other users and roles.
While creating the roles , Admin can add permissions to it . i.e what menu items can this type of user role can access ?
The challenging part is that , I need to specify auth guard to the…

Anusha Krishnamurthy
- 157
- 1
- 2
- 14
2
votes
0 answers
Angular Auth0 after login secured auth guard page doesn't show after redirect
I am testing Auth0 with angular for the first time and have run into an issue. I let my user login trough Auth0 and after they have logged in I redirect them to my dashboard page that is protected with Auth0 guard. I have managed to redirect the…

imkeVr
- 442
- 1
- 7
- 30
2
votes
1 answer
AngularFireAuthGuard with multiple conditions
I am working on a Ionic project which is using AngularFire. Application has two main features.
Feature 1. Requires users to create an account and login.
Feature 2. Doesn't require an account or logging in.
I am using AngularFireAuthGuard with…

Fulya D.
- 592
- 4
- 9
2
votes
2 answers
Behavior subject not updating subscriber on .next(value)
I am having an issue with getting a Behavior Subject to update a subscriber on the .next(value) call.
I am new to typescript but i think i must just be missing something small. it seems correct from what i have seen.
There were quite a few issues…

Imgoinghamm
- 53
- 1
- 6
2
votes
2 answers
How to remove queryParams after navigation | Angular
I am using Angular application and trying to check in CanActivate if token is valid, if it's valid so return true. When true, I need to delete it from the url
I've tried this code to delete the url param
let url: string =…

Kenana Reda
- 430
- 1
- 9
- 24
2
votes
0 answers
Using @ngrx/store element in Angular AuthGuard
I am trying to use a element from ngrx/store in my authguardService.
When the routing comes to the point where it checks canActivate it works correctly, but when the element changes, the route guard doesn't change it's output and the canActivate…

mait.taim
- 134
- 1
- 12
2
votes
0 answers
Ons Tabbar messes when used with angular 2+ AuthGuard
I am using Onsenui with Angular 6
When I use Onsenui Tabbar Directive without using angular AuthGuard, it works fine.
but when i use AuthGuard on component or say "canActivateChild: [AuthGuard]", it shows this error everytime i click on one of the…

Hilal Kaldane
- 145
- 1
- 9
2
votes
1 answer
candeactivate with child routes not working
I have routing as below:
{
path: "home",
children: [{
path: "dashboard",
children: [{
path: "user",
canDeactivate: [CanWeDeactivateThis]
}]
}]
}
There are components defined in routes, above is just a simple…
user10752804
2
votes
1 answer
Angular - AuthGuard is redirecting Iframe
I am implementing an iFrame in my angular application. When i am giving the src url directly in the html, the app is working fine and loading the requested UI. But when i am fetching the src url from backend and passing it as a variable auth guard…

Yerramsetty G D Surya Prakash
- 79
- 1
- 13