Questions tagged [auth-guard]

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

164 questions
0
votes
1 answer

AuthGuard not working properly in Angular

In My Application I am redirecting to the Home Page on successful login , when user logs in I am setting isLoggedIn to true in local storage but when I refresh the home page it redirects to Login page again, but the isLoggedIn is still set to…
0
votes
0 answers

Why is my sign-In state is not synced in AuthGuard

I'm working on an Angular app that uses Google OAuth. In my route module, I set up AuthGuard to protect some of the routes so users cannot access these pages if they are not signed in. Once they finish authorization, the route would automatically…
0
votes
2 answers

How to Implement Angular Auth Guard

I am building an Angular application. In this application, I used Auth Guard to secure the application. I added the Auth guard in the following way. { path:'order', component: OrderComponent, canActivate: [AuthGuard]} When I click on Order If the…
Devmina
  • 45
  • 9
0
votes
0 answers

Angular Auth0Guard redirect to universal login. Any options?

I'm using Auth0/angular in order to implement my login and actually is working perfectly. But, when trying to protect routes, i'm using AuthGuard from the same library, so when the user tries to access to a component that is protected by that Guard…
Raziak
  • 360
  • 1
  • 7
0
votes
0 answers

Undefined array key "email"

I can't seems to find the reason why it gives me the error Undefined array key "email" I'm sorry in advance if the info that I'm providing is not enough please tell me what info you guys need. here is my admin controller namespace…
0
votes
1 answer

I am getting an "There is no matching message handler defined in the remote service." for my NestJS Microservice

I am creating a NestJS 'Auth' microservice that our other graphql microservices can use, mostly to create guards for each microservice. In this case let's just call it 'Other'. I have followed multiple documentation sources, checked that the port…
0
votes
0 answers

Angular Auth Guard redirect not working in Azure

We have an angular 11 app deployed as Azure Static Web App. The Auth Guard is implemented and WORKING IN LOCAL that means running in VS with F5 everything is fine. However, on Azure, trying to access an unauthorized page result in a 404 not found…
Marc Roussel
  • 459
  • 9
  • 20
0
votes
1 answer

ERROR Error: Uncaught (in promise): Error: Invalid CanActivate guard Error: Invalid CanActivate guard

so i want to implement auth guard to redirect user to login page if he is not logged in yet. For example , when am in login page , when i type "/dashboard" in my url , i want the user to be redirected to login in case he is not authenticated , but…
Aziz
  • 35
  • 5
0
votes
1 answer

hasCustomClaims redirects to blank page

I am using hasCustomClaim to guard a route from non admin users. const adminOnly = () => hasCustomClaim('admin'); The problem here is after a simple user tries to visit the forbidden path, he get redirected to localhost:4200 even if I have already…
Mohammed
  • 171
  • 2
  • 11
0
votes
0 answers

Routes / Interceptor not working in Angular 11 App

I'm having the classic issue of my Angular 11 app not working after having made some changes, without knowing which change caused it. The app should be redirecting the user to "auth/login", but the call to router.navigate doesn't seem to do…
0
votes
1 answer

Angular avoid Route parameter (:id) and navigate to specific link

In our project, I have to implement a navigation or redirect to a maintenance page, if maintenance mode is activated. I wanted to do this in the AuthGuard service, and do something like: canActivate(...) { if (this.inMaintenance()) { …
MMMM
  • 3,320
  • 8
  • 43
  • 80
0
votes
1 answer

Angular canActivate guard service not working correctly

I implemented a simple auth service and auth guard: auth.service.ts: import { Injectable } from '@angular/core'; import { Observable, of } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class AuthService { isAuthed: boolean = false; …
MMMM
  • 3,320
  • 8
  • 43
  • 80
0
votes
1 answer

Angular route protection with AuthGuard use only one time

i am protecting all my routes with a single Authguard and right now i am using in each route canActivate: [AuthguardService] my application has 30+ routes and so i need to type this 30 times in each route. Is there a way to protect all my routes…
GreekSwiss
  • 37
  • 8
0
votes
1 answer

canActivate from angular calls the function before the queryParams find the param (angular)

I'm using an canActivate class method to make an authguard from my pages, when only autorizated the user access this page if pass the boolean check. The problem is that my queryParams only find the param in the URL after the page is full loaded,…
Lazarus
  • 75
  • 1
  • 1
  • 4
0
votes
1 answer

CanActivate, Cant map to subject

My group and I are building a website using angular for the client side. We're trying to use AuthGuard to lockdown the routes but are having trouble not being able to map to the subject. LoginService: import { HttpClient, HttpErrorResponse } from…