1

I am trying to access the Angular Service Object (I have set the AuthContext in service) but Angular Guard is giving undefined even though that is well set.

I have login component, which I call first and internally It uses the Angular Auth Service. In the constructor of that service, I ensure that AuthContext is well set. Through the debug, I have seen that object is available with all the required claims.

But then when I access the regular component (which I have guarded through the Auth Guard) CanActivate method in that Guard fails to access the context.

Any idea why? Here is little overview of my code...

enter image description here

enter image description here

I also have tried to use the console log and it looks like Auth Guard called before the service class. But Auth.Guard, I have used authservice in constructor and by virtue of Dependency injection, Service object should get called.. Don't know what's wrong here...

Here is console log enter image description here

any suggestion?

Brijesh
  • 61
  • 1
  • 11

0 Answers0