Questions tagged [auth-guard]

Refers to Angular's AuthenticationGuard class, a route protection mechanism most commonly implementing `canActivate`.

164 questions
0
votes
0 answers

JS: Unhandled Promise rejection: Cannot match any routes. URL Segment: 'resetPasswordRequest/:id' ;

I have this router.ts { path: 'resetPasswordRequest/:id', component: ResetPassIdComponent, canActivate: [AuthGuard]} In component ResetPassIdComponent I get id with this code: ngOnInit(): any { let myid =…
web site
  • 99
  • 8
0
votes
1 answer

how to match url that contains dynamic placeholder

so I'm Trying to add route guard using angular and I have a URL that contains dynamic placeholder domain/profile/:id/public => ex. domain/profile/1/public and i want to check if the targeted URL is the same URL as for this page or not I tried…
Omar Abdelhady
  • 1,528
  • 4
  • 19
  • 31
0
votes
0 answers

Ionic4 Angular AuthGuard works for home page and not for sign in page

I have created an Authguard for my web app and have assigned into several routes like Home, Sign-in, Sign-up etc. Expected Behavior: Home page - the intention is to show the login page if the user is not logged in Signin , Signup, Forgot Password…
0
votes
0 answers

Vue router authentication-guard unable to recognize my vuex store

I am trying to guard a vue component in the global router.js file using the beforeEnter(), however i keep getting a type error in the console thats says cannot read property getters of undefined Here is an example of router.js file import login…
MoSwilam
  • 824
  • 2
  • 10
  • 26
0
votes
1 answer

Redirection problem with Angular AuthGuard

I'm trying to redirect users to a certain route if they are already logged in on the platform (I check this using cookies) when they access my website's base url. The expected behaviour is this: User goes to www.example.com. If he is already…
Warthaxx
  • 53
  • 2
  • 11
0
votes
0 answers

Uncaught (in promise): TypeError: guard is not a function - when Class extends Another Class

The same configuration that I have below was working fine just before one day and not working any more on my machine. I checked on other machine and it is still working fine on those machines. Here is what I'm doing. App-Routing: const routes:…
0
votes
1 answer

In angular when i login how to set timeout and navigate away form that route?

Here is the function: onSubmit(value){ this.authService.login(value.email, value.password) .then( res=> {}) .catch(error=> {console.log(error);} ) } I think in the res I have to set timeout. I have the authGuard that's why I need the…
0
votes
2 answers

Angular 6 - roles/claims based auth guard not working

Authenticated users in my app can have several roles, therefore, I want to guard routes based on users' specific roles. I included roles checking in method checkAuthentication() in AuthGuardService, then apply data: { roles: ['USER'] } in routing…
Hoàng Nguyễn
  • 1,121
  • 3
  • 33
  • 57
0
votes
1 answer

Why is it not possible to return Obeservable.of(false) in catch block in canActivate method?

I use the canActivate feature to protect some routes (admin). For this case I do use the an authGuard class/function: The issue is, when I try to return an observable of boolean as: return Observable.of(false);, it doesn't work as expected and…
k.vincent
  • 3,743
  • 8
  • 37
  • 74
0
votes
0 answers

angular 5 auth guard navigation

My application works fine without auth guard when I try to implement the security I got navigation problem. The problem is auth guard is passing the condition(tested using console.log). The url is changing to /prpage butviewport still remains in the…
dev
  • 403
  • 2
  • 5
  • 11
0
votes
1 answer

Implemented Auth guard in angular 6 application. Implementation is not working.

Implemented Auth guard in angular 6 application. Implementation is not working. Auth Guard export class AuthGuard implements CanActivate { constructor(public manageAccountService: ManageAccountService, public myRoute: Router) {} …
Arsalan Akhtar
  • 395
  • 2
  • 15
0
votes
0 answers

Angular5 routing issue

Working on an angular5 facing router issues while navigating from one component to another The error says: Cannot activate an already activated outlet Please find the screenshot for code, header nav and error. error screenshot, routing module auth…
Snehitha
  • 19
  • 6
0
votes
1 answer

Authentication with Angular 5

I have a login page and I need to go to my home page after successful login. That login functionality login to a ldap server and send a response whether the authentication is success or not. I don't want that to keep in localstorage since this app…
Supun Wimukthi
  • 85
  • 4
  • 12
0
votes
2 answers

Auth Service and Login Component not communicating

I'm using Angular 4 and trying to return a boolean from the Auth Service, but when I try to console.log the value, it returns undefined. I'm trying to return the boolean value and make a if/else statement redirecting the logged user to the…
0
votes
1 answer

Angular5 routing: Routes after canActivate are ignored

I'm trying to implement routes to separate a public and a secured area. What i tried to accomplish: User IS authenticated: The route which is loading the routes from SecureModel should be "skipped". User is NOT authenticated: The route which is…
FaHuSchmidt
  • 101
  • 1
  • 6
1 2 3
10
11