Questions tagged auth-guard

Explore the latest questions and answers asked by our top developers.

How can i use canActivate() to block access to certain routes?

I am actually working on an website that have multiple users. I want to update a user’s information and it works so fine but when i type on the URL an id of another user instead of the current user i can simply access to that profile while i am not supposed to . Source: […]

By BHIRI Yosri
Published
Categorized as angular, auth-guard, canactivate, routes Tagged , , ,

CanActivate on pagination in Angular

I have server side pagination on a list screen in angular. When I click on the link to visit the screen, sometimes the pagination number doesn’t appear and I have to double click the link to get the number. I have used CanActivate guard on the screens so that the screen gets displayed only when […]

By Ahmad
Published
Categorized as angular, auth-guard, canactivate Tagged , ,

Cannot protect user form accesing sign-in page with guard in angular

I would like to prevent user from accessing login page if already logged. I’m using Angular with Firebase authentication. I successfully prevent user from accessing the app by writing an auth.guard.ts like that : import { Injectable } from ‘@angular/core’; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from ‘@angular/router’; import { Observable } from […]

Angular how to disable authGuard on particular child page

can anyone suggest best way to disable authguard (applied on parent level) on a single child page. ROUTES:Routes = [ { path: ”, component: AdminComponent, children: [ { path: ”, pathMatch: ‘full’, data: { title: ‘Home’ }, loadChildren: ‘src/app/admin/dashboard/modules/dashboardRouteModule#DashboardRouteModule’, }, { path: ‘dashboard’, redirectTo: ” }, { path : ‘blog’, data: { title: ‘Blog’, breadcrumb: […]

Angular Auth Guard is not navigating to new Route

My Auth Guard is working as intended in regards to attempting to search a URL without logging in. However, when signing in, the navigation in the URL does not change and the user is not routed to the correct page. It is*, however, running the correct sign in method to reroute to the intended page, […]

By ACDev
Published
Categorized as angular, auth-guard Tagged ,

Read only permissions in Angular by route

Currently i have the type of permission on a service and i want to set read-only by path. Is there any way to do it? Something like the auth guard. Thx Source: Angular Questions

By David Rod
Published
Categorized as angular, auth-guard, permissions Tagged , ,

Read/Write only permissions in Angular by route

Currently i have the type of permission on a service and i want to set read-only by path. Is there any way to do it? Something like the auth guard. Thx Source: Angular Questions

By David Rod
Published
Categorized as angular, auth-guard, permissions Tagged , ,

Angular Auth Guard with a Promise and if statement

I want to use a guard to decide whether or not a user can navigate to the login pag, but I know my logic is faulty because of a Promise. See my code below. canActivate(): boolean | Observable<boolean> | Promise<boolean> { if (!this.localStorage.getObject(‘isInitialized’)) { this.router.navigate([‘/locaties’]); return true; } return false; } I know what I’m […]

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, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from ‘@angular/router’; import { BehaviorSubject } from ‘rxjs’; import { User } from ‘../data/schema/user’; import […]

routing redirects always to homepage component after refreshing, how do i stop this happening?

im building an angular app with very basic authguard authorization. in app i also have 2 components that render depending on the user if its logged or not. problem is, always that i refresh page on some component, routing doesnt stay on that component but redirects to homepage. Ive like to stop this to happen. […]

1 4

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq