Questions tagged [auth-guard]

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

164 questions
0
votes
1 answer

return value subscribe directly into canActivate auth guard

Below are my code, what im tring to do is im trying to get return value directly into canActivate return, but the problem is it will run the checking first before run "this._authService.isAdmin(token)" method. i know it like that because of async.…
FlyingTurtle
  • 145
  • 4
  • 19
0
votes
2 answers

Error: Uncaught (in promise): ReferenceError: localStorage is not defined

I am programming a Single Page Application using Angular/Typescript. The application starts with an Login Page. When the user is authenticated a new page is loaded using this line of code: this.router.navigate(['/productionFiles']); And that works…
Nulajo
  • 31
  • 3
0
votes
1 answer

angular2-jwt token is not working, LoggedIn function not working

I am making a simple mean auth app, where angular2-jwt is used to authenticate the user logging in, right now, i want that before logging in, i dont want Dashboard, Profile to be shown on navbar, whereas after login, Register and Login should be…
0
votes
2 answers

Http Error Handling is not working with map in Angular

I'm new to Angular and I'm working on a project which uses Angular 5 as frontend and Laravel5.5 as backend. What I am trying to do: I'm doing token based authentication to check if the correct user is sending the request to backend and if the token…
Adnan Sheikh
  • 760
  • 3
  • 13
  • 27
0
votes
0 answers

Angular 4 & Firebase auth guard

I currently implementing angular4 example application. I am having some problem with auth guard. I want to block route based on the user's role. Firebase - user document auth.guard.ts canActivate( next: ActivatedRouteSnapshot, state:…
0
votes
1 answer

Authguard needs to be based on a chain of two subscriptions

I am trying to use authgaurd in angular 4 to limit access to the website based on the userid of the person trying to access it. This is running on a Intranet and all users will be domain users authenticated by microsoft active directory. My…
Joe
  • 43
  • 1
  • 5
0
votes
1 answer

Auth Guard is applied on Lazy Loaded Modules in angular2 but still it is Redirecting Despite of Rejection canLoad Is Not Working

Assuming Return false will be returned on authentication either on http call but for now i am returning false from CanLoadChildren() Method Inorder to test canLoad But despite of calling canLoad and returning false canLoad still loads Module and…
-1
votes
1 answer

context.switchToHttp is not a function

This is my combined Auth Guard in this I am getting the error "context.switchToHttp is not a function." import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; import { JwtAuthGuard } from './jwt.strategy'; import {…
-1
votes
1 answer

Make a component render in more than one page - Routes Angular 13

I have the following routes, and I need to render the Conditional component in some specific routes, but the shared component in all routes. How can I do it? const routes: Routes = [ { path: "someroute", component: ConditionalComponent, children: [{…
Lazarus
  • 75
  • 1
  • 1
  • 4
-1
votes
1 answer

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…
-1
votes
1 answer

How to implement Forgot password using POST REST API in Ionic 4?

Ionic 4: How to implement Forgot password functionality using the POST method: REST API? I've already checked the user with REST API and it's validated but I'm not sure how to send the validated user's email and new the password with 2 fields like…
-1
votes
2 answers

No Firebase App '[DEFAULT]' has been created- call Firebase App.initializeApp()

Before implementing authGuard in my project, everything was working fine. But, it seems authguard throwing an error. I removed the authguard from the page and it was working. but then again added it back gave error. App.routing.module.ts { path:…
Mr.Shah
  • 61
  • 7
-1
votes
1 answer

Refresh page get log out automatically in angular 5

I'm using firebase for the signIn and signup. that is my authService look like : token: string; authenticated: boolean = false; signinUser(email: string, password: string) { firebase .auth() …
-2
votes
1 answer

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 EDIT Sidebar: Section1 link1p link2p Section2 link1x link2x An example of my database…
David Rod
  • 11
  • 6
1 2 3
10
11