@auth0/auth0-angular user$


Which SDK this is regarding: auth0-angular
SDK Version: 1.11.1
Platform Version: Angular 15.2.3
Code Snippets/Error Messages/Supporting Details/Screenshots:

I have been struggling to understand an issue i have been having and i’m hoping someone here can help me.

So i have my routes protected by the auth guard provided by @auth0/auth0-angular and a custom auth guard which subscribes to the user$ subscription to get the users roles so i can verify if they have the correct role to access a route. These guards run sequentially.

Steps to repeat issue:

  1. Wait past access tokens expiration period
  2. Navigate to a route protected as mentioned above
  3. AuthGuard does not redirect to Auth0 Login (i assume the isAuthenticated$ is still true because you are authenticated with Auth0, it doesn’t care about whether your access token has expired or not)
  4. The user$ returns null which according to the docs happens if the user is unauthenticated.

In my head if i got through the first auth guard the second would always be able to retrieve user information.

What am i missing?


Hey there!

It seems like the most effective way to handle that would be to raise a GitHub issue in the angular repo here:

so we can discuss it directly with the repo maintainers. Once you have a link to it make sure to share it here so we can ping them. Thank you!

Interestingly updating to V2 of the @auth0/auth0-angular fixed this issue and for anyone wondering the migration process is fairly straight forward and is documented here: auth0-angular/MIGRATION_GUIDE.md at master · auth0/auth0-angular · GitHub

Perfect! Thanks for sharing that with the rest of community!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.