Multiple Auth0 Client Configurations in a single Angular project

I’m trying to use multiple auth0 applications in a single Angular project. From the auth0-angular README.md:

Instead of using AuthModule.forRoot to specify auth configuration, you can provide a factory function using APP_INITIALIZER to load your config from an external source before the auth module is loaded, and provide your configuration using AuthClientConfig.set.

The configuration will only be used initially when the SDK is instantiated. Any changes made to the configuration at a later moment in time will have no effect on the default options used when calling the SDK’s methods. This is also the reason why the dynamic configuration should be set using an APP_INITIALIZER, because doing so ensures the configuration is available prior to instantiating the SDK.

I would like to create a single Angular project that allows for two different types of user to login, each through a different auth0 application that presents a different login page. This would seem to require the ability to dynamically change the AuthClient configuration, rather than only being able to set the configuration once with no way to change it further.

Is there a way to achieve this?

bump - also having this problem :\

me also have same issue

Hi @james.williams1,

Welcome to the Auth0 Community!

I don’t think the SDK was designed with two different simultaneous configs in mind. You can try multiple Auth0ConfigFactories for the authentication provider.

But you can give more details about what the structure of your application is and where would two AuthClients come in use and we can maybe find a solution.

Have a good one,
Vlad