auth0-angular icon indicating copy to clipboard operation
auth0-angular copied to clipboard

Refactor the `provideAuth0` function to return an `EnvironmentProviders` instead of `Provider[]`

Open LcsGa opened this issue 1 year ago • 1 comments

Checklist

  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

In the EXAMPLES.md it is stated that

provideAuth0 should never be provided to components, but only at the root level of your application. Currently, nothing is preventing you to avoid it.

Describe the ideal solution

I propose to update the current code to using makeEnvironmentProviders (that has been created especially for this kind of requirements):

provideAuth0(config?: ...) {
    return makeEnvironmentProviders([...]);
}

Alternatives and current workarounds

No response

Additional context

No response

LcsGa avatar Nov 26 '24 11:11 LcsGa

About breaking changes: There is a possibility of including a breaking change if some people didn't take the note you've written into account.

LcsGa avatar Nov 26 '24 11:11 LcsGa