# Issue Setting up Dynamic Configuration

**URL:** <https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [March 19, 2025, 9:07pm UTC](https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158 "2025-03-19T21:07:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmejia](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rmejia/32/71278_2.png) [@rmejia](https://community.auth0.com/u/rmejia)\
**Post date:** [March 19, 2025, 9:07pm UTC](https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158/1 "2025-03-19T21:07:14Z")

</div>

I am working on switching an Angular application to Auth0.  
Currently working on deployment and needs dynamic configurations.

I followed this method:

```auto
function configInitializer(
  handler: HttpBackend,
  config: AuthClientConfig
) {
  return () =>
    new HttpClient(handler)
      .get('/config')
      .toPromise()
      // Set the config that was loaded asynchronously here
      .then((loadedConfig: any) => config.set(loadedConfig));
}

```

With this in my providers:

```auto
  providers: [
    {
      provide: APP_INITIALIZER,
      useFactory: configInitializer, // <- pass your initializer function here
      deps: [HttpBackend, AuthClientConfig],
      multi: true,
    },

```

When I try this I get the error of Configuration needs to be set AuthModule.forRoot() or AuthClientConfig.set.

When entering empty values on AuthModule.forRoot(), check the values before logging on to AuthService.  
I find that the Auth0Client has no configuration set, and the Auth0COnfig does have the values.  
The redirect goes to https:\authorization\ without my auth0 domain.

Thank you for your time.

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [March 21, 2025, 8:01pm UTC](https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158/3 "2025-03-21T20:01:10Z")

</div>

Hi @rmejia,

Welcome to the Auth0 Community!

Make sure you also insert the imports like in the example below:

> **[AuthClientConfig | @auth0/auth0-angular](https://auth0.github.io/auth0-angular/classes/AuthClientConfig.html)**
>
> Documentation for @auth0/auth0-angular

If you have any other questions feel free to reach out.

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![rmejia](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rmejia/32/71278_2.png) [@rmejia](https://community.auth0.com/u/rmejia)\
**Post date:** [March 28, 2025, 7:48pm UTC](https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158/4 "2025-03-28T19:48:55Z")

</div>

I found the solution. It wasn’t auth0, it was my application.  
HttpBuilderService was calling my custom Auth.service.ts.  
This causes a dependency on the auth0 AuthService, which my custom authservice uses.  
My solution was to set up the dynamic configuration with the example and then with a separate method called after to inject the authservice instead of injecting at the constructor.

import { AuthService as auth0service } from “@auth0/auth0-angular”;

\_auth: auth0Service  
injector: Injector = inject(Injector);

int(){  
this.\_auth = this.injector.get(auth0service);  
}

thank you

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 11, 2025, 7:49pm UTC](https://community.auth0.com/t/issue-setting-up-dynamic-configuration/184158/5 "2025-04-11T19:49:01Z")

</div>

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