Support for non default audience in auth0-angular

@auth0/auth0-angular - latest version (currently 1.7.0)


We’re struggling with the lack of support for non default audiences in auth0-angular. On auth0-spa-js it’s possible to pass audience as a parameter to methods on the authClient such as getUser & getIdTokenClaims, however this is not possible in auth0-angular which is causing us some headaches.

If the user has a token but not for the default audience it’s not possible to see the idToken values on the user$ observable, instead we’re having to make a call to our API to look up the details on the management api and return that instead which is not efficient.

We think this would be solved if auth0-angular exposed the underlying auth0-spa-js authClient instance so that we can use the methods on that directly. Aside from that happening is there any way that we can accomplish what we need with the existing auth0-angular package?

Hey there!

Gotchya! I think the most effective way of handling that would be to raise a GitHub issue in the repo so we can discuss that directly with SDK maintainers. Thank you!

Our Angular SDK already exposes the Auth0Client instance as of 1.6.1, see Provide a way to retrieve the ID Token using a custom (non-default) audience · Issue #214 · auth0/auth0-angular · GitHub.

As mentioned on Support for non-default audience · Issue #225 · auth0/auth0-angular · GitHub, I would love for having a more Angular way of supporting this. But given it is possible using today’s SDK and the fact that it is a not so common use-case, it’s not something we are prioritizing in the short-term, but happy to review any PR that implements this in a non-breaking way.

1 Like

Thanks for following up on that Frederik!

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