I want to do laravel angular jwt authentication, so I want to apply guard but it gives me error: Invalid configuration of route '': redirectTo and canActivate cannot be used together. Redirects happen before activation so canActivate will never be executed
.
app-routing.module.ts
const routes: Routes = [
{ path:"", redirectTo:"/adress", pathMatch:'full', canActivate:[AuthGuard] },
];
RedirectTo and canActivate cannot be used together. Redirects happen before activation so canActivate will never be executed.
In Angular 14, you can no longer use them both in the same configuration. Choose between redirectTo and CanActivate in your inspect/ route configuration, keep the most reliable for your case and you should be good to go.
You can find more details in the following link: https://stackoverflow.com/a/74052870/4983912.
I hope this will help.