Skip to main content
2 votes
2 answers
54 views

How to prefix automatically language in path of route with Angular 14

I try to add the language of customer directly in the path like /en/dashboard And if a customer go to the web site with an older link, like /home I want to add automatically the default language in ...
R3tep's user avatar
  • 12.8k
0 votes
0 answers
49 views

Calling canActivate function of all providers implementing CanActivate in Angular

I created a .NET DLL I want to use together with an Angular UI implementation. The DLL offers some basic operations such as job monitoring. I also implemented some basic authentication that provides ...
Marius Vasile's user avatar
1 vote
1 answer
143 views

How to implement state managed by auth reducer in angular auth guard using new CanActivateFn instead of deprecated CanActivate?

// auth.guard.ts export class AuthGuard implements CanActivate { constructor(private store: Store<fromAuth.AuthState>, private router: Router) {} canActivate(): Observable<boolean> { ...
nerdWannabe's user avatar
0 votes
1 answer
96 views

Upgrade from Angular 7 to 14 - routing problem -redirectTo and canActivate cannot be used together

I get this error Error: NG04014: redirectTo and canActivate cannot be used together. Redirects happen before activation so canActivate will never be executed. after upgrading angular 7 to 14. Anyone ...
sourabh's user avatar
  • 33
1 vote
3 answers
123 views

Error using HttpClient in canActivate class | [ERROR] NullInjectorError: No provider for _HttpClient

I've some troubles when I want to use HttpClient in a CanActivate class. I want to do some POST request in order to find my token in a Django API. Examples are better than words : auth.guard.ts : ...
Alos's user avatar
  • 11
2 votes
1 answer
828 views

Service Injection in CanActivateFn - Angular 16.2

I'm trying to use the value I collect from the Authorization Header in an authGuard. The Service that manages the login successfully logs the value I expect. import { HttpClient, HttpResponse } from '@...
Giuseppe Lepore's user avatar
0 votes
0 answers
310 views

How do I use a CanActivateFn to hide a link?

I am using CanActivateFn rather than CanActivate to handle my routing authentication. Here is my app-routing.module.ts: import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@...
Jerome's user avatar
  • 816
0 votes
1 answer
77 views

Authorization Issue with Angular Auth Guard canActivate method

I am using an Angular authentication guard to handle authorization for each route. I need to call two API endpoints to retrieve user information and current user privileges. With my code, it follows ...
heshjse's user avatar
  • 910
3 votes
1 answer
2k views

Router parseUrl() vs navigate() in Angular16

I am in Authenticate with authGuard. I would like to know the difference between these two // Redirect to the login page return router.navigate(['/login']); return router.parseUrl('/login'); In ...
Pamba's user avatar
  • 822
0 votes
2 answers
977 views

How to get dynamic parameter in functional canActivate guard without ActivatedRoute in Angular v16?

I'm trying to implement a functional canActivate guard in Angular v16, but I'm facing an issue with retrieving dynamic route parameters. I want to access the username and id parameters from the route ...
syahiruddin's user avatar
0 votes
1 answer
1k views

Angular CanActivate Guard

I am developing a small project using Angular, Nodejs, Express, MySQL. In the project there is 2 type of user, customer user and contractor user. I am having difficulty in using CanActivate to guard ...
HengHeng123's user avatar
1 vote
1 answer
58 views

Angular : Routes access restrictions for Logged users

I Need to restrict the logged in user from accessing all the routes when the user is forced to change password after its expiry. The user should not be able to manipulate the URL in the address bar ...
RandomSync's user avatar
1 vote
0 answers
261 views

Auth guards for google oauth2 connection always returns false

I'm on a angular project using angular-oauth2-oidc. There is login component, a home component and a auth guard that enable to go to /home only if I'am connected. The connection is with google sign in ...
Lucas's user avatar
  • 19
1 vote
1 answer
1k views

Return boolean observable on angular guard

I would like to block URL access from unauthorized users. I'm currently using canActivate with route Guard from angular to block users to access /my/specific_url_route. Indeed, I want to block some ...
Dorian's user avatar
  • 37
0 votes
1 answer
370 views

Lock/deny url from users (angular guard)

I would like to block url access from unauthorized users. I'm currently using canActivate with route Guard from angular for blocking no Admin user to access /admin route (that's works OK). But now, I ...
Dorian's user avatar
  • 37

15 30 50 per page
1
2 3 4 5
11