Refers to Angular's AuthenticationGuard class, a route protection mechanism most commonly implementing `canActivate`.
Questions tagged [auth-guard]
164 questions
1
vote
2 answers
Deactivation of angular router link
I am making angular application, where i am using routing and auth guard..
stackblitz
app component html
1
vote
2 answers
Angular: browser refresh handling in AuthGuard
I have been trying to implement AuthGuard properly in my webapp. Currently when I navigate within the app, it works fine. But when I refresh, the authService.loggedIn is processed as false before the AuthService finished executing.
Here is my…

gritbranch
- 199
- 3
- 14
1
vote
0 answers
angular ngrx/store authguard user property undefined issue
I'm building an app in angular that is using ngrx/store for state management and it has a user object as part of the state.
User class
export class User {
constructor (
public email: string
) {}
get is_signed_in(): boolean {
…

ferd tomale
- 845
- 7
- 20
1
vote
2 answers
How can I route to login if canLoad or canActivate fails, without routing in AuthGuard itself?
So, this is what my AuthGuard looks like:
canLoad(route: Route) {
return this.store.select(fromRoot.getIsAuth).pipe(take(1));
}
I check Authentication information from app.component and simply return an Observable boolean.
I don't want to…

Tolga Açış
- 168
- 1
- 16
1
vote
2 answers
Angular 6 : Empty path bypass auth guard
I'm trying to use the Angular router, and I'm having an issue on the empty path . Here's my routes:
const routes: Routes = [
{ path: 'feed', loadChildren: './feed/feed.module#FeedModule', canLoad: [AuthGuardService] },
{ path: 'login',…

BZHNomad
- 63
- 2
- 6
1
vote
1 answer
How to make AuthGuard wait for LocalStorage in Angular 4?
I have developed a website in Angular 4 and ASP.Net Core. However, there's one thing that has been bugging me. It has some basic login implementation with JWT and i'm using local storage to save the user object and the token.
Everything works great…

Lucas Arruda
- 533
- 1
- 8
- 15
1
vote
3 answers
Implementing native multi auth (user vs admin) using guards in Laravel 5.5 - guest middle ware uses hard coded named route
I would like to implement native multi authentication in my application for two types of users: User and Admin.
I started implementing a new admins table migration (by copying the existing create_users_table).
I created a new model called Admin (by…

Latheesan
- 23,247
- 32
- 107
- 201
1
vote
1 answer
angular 4 router auth-guard not invoked on same route
Hi i configured this routing:
const routes: Routes = [
{
path: '',
component: LayoutComponent,
canActivateChild: [AuthGuardService],
children: [
{
path: '',
pathMatch: 'full',
redirectTo:…
user9223099
1
vote
3 answers
Is angular 4 auth guards server sided or client sided? If it is client sided can it be hacked?
I am currently working on angular 4 on a project. I'm familiar with angular auth-guards. My question is since angular 4 is a client sided framework can't we hack the auth-guard to access the page by inspecting the browser window, since typescript…

Rolwin
- 33
- 1
- 4
1
vote
0 answers
Loading Last Active Component Upon Re-logging in Within Same Session in Angular 2 App
Right now in my Angular 2 app I am handling logging in and logging out successfully. I'am also using ActivatedRoute and queryParams to re-load all the last loaded components upon the event of the user logging out, and then logging back in, all…

Muirik
- 6,049
- 7
- 58
- 116
1
vote
2 answers
Conditional Based Auth Guard in angular routing. (Route Protection not just navigation only)
I am creating one angular2 app.
export const routes: Route[] = [
{path: '',redirectTo: "login",pathMatch: "full" },
{path: 'login', component: LoginComponent },
{path: 'dashboard', component: DashboardComponent,canActivate:[AuthGuard], children:
…

Pardeep Jain
- 84,110
- 37
- 165
- 215
0
votes
0 answers
NestJS PermissionsGuard, user permissions is always undefined using Auth0 valid token
I know my token is valid and contains the permissions alongside the email and role, since when I use jwt.io on what is received in the back I get something like this:
{
"https://xxx/roles": ["admin"],
"https://xxx/email": "test.test@gmail.com",
…

Koyaki
- 29
- 2
0
votes
0 answers
Redirect in angular not going to the correct page after authguard
I've got a structure for redirection after log in in which we are sent to a page which tells the user to log in, after log in a service tries to redirect the user to the page they were trying to visit before the redirection. I keep the page visited…

paula.em.lafon
- 553
- 2
- 6
- 15
0
votes
0 answers
How can I mock 'nest-keycloak-connect' guard in nestJs controller unit-test?
I have a simple controller that uses nest-keycloak-connect implementation of guard to restrict access to the resource. This is a snippet of the controller's code:
import { AuthGuard, ResourceGuard, Roles } from…

ishulz
- 103
- 1
- 2
- 6
0
votes
1 answer
Angular routing (AuthGuard) inside a Docker Container
I have just deployed my Angular project inside a Docker Container. Path for me to access to the site is: localhost:4200, because on my machine is listening on 4200, but inside the container is listening at port 80.
I'm using Angular routing, here's…

ShadyRaso
- 25
- 4