Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add provideAuth0 method #444

Closed
Lonli-Lokli opened this issue Mar 31, 2023 · 3 comments
Closed

Add provideAuth0 method #444

Lonli-Lokli opened this issue Mar 31, 2023 · 3 comments
Labels
feature request A feature has been asked for or suggested by the community

Comments

@Lonli-Lokli
Copy link

Describe the problem you'd like to have solved

With standalone angular app provideXXX is the best way for importing components during bootstrap to get rid of NgModules.

Describe the ideal solution

new method similar to Auth0.forRoot

Alternatives and current work-arounds

Additional context

@Lonli-Lokli Lonli-Lokli added the feature request A feature has been asked for or suggested by the community label Mar 31, 2023
@frederikprijck
Copy link
Member

frederikprijck commented Apr 2, 2023

Thanks. I do believe providing a provideAuth0 method is something we should do as soon as possible.

However, I am not sure it's a good idea to do so before we are compiling our SDK using Angular 15 (which is expected to happen in november 2023), currently we are using Angular 13. Given the simplicity of our SDK, we aren't compiling a version for every major angular version, instead we are compiling using the lowest supported version of Angular at the moment, which is 13 atm. This has the downside that we have no access to the latest things as soon as they come out. However, if anything would lead to our SDK to become unusable, we will make chances as needed. In this case, I believe it's all just syntactic sugar and there isn't anything limiting you to use our SDK in it's current state.

The reason I am saying we want to wait until Angular 15 is because we have no ability to use EnvironmentProviders yet (until we rely on Angular 15 and drop support for anything below Angular 15), which I believe we should include as part of the provideAuth0 method we want to expose, as it's the equivalent of forRoot, to ensure provideAuth0 will only be possible in the root (and not in components).

We could already offer a provideAuth0 function today, and ignore the EnvironmentProviders. However, if we would include it once we compile using Angular15, it could be considered a breaking change.

Therefore I believe it's better to hold of until we compile using Angular 15. In the meantime, this is how you should be able to use our SDK with Standalone and more functional approaches, with no downsides as far as I am aware: #442 (comment).

Having said that, happy to hear anyones opinion.

@frederikprijck
Copy link
Member

frederikprijck commented Apr 3, 2023

Having said all of the above, I opened a draft PR to add support for this as I believe we want to facilitate modern approaches where possible, especially if they are easy to support.

When Angular 15 comes out, we plan to add support for EnvironmentProviders, which could break people.
However I added a comment to ensure people should not use it in a component's providers. That way we can justify changing the behavior to include EnvironmentProviders without cutting a major version.

@Lonli-Lokli Could you have a look and see if this PR works for you?

@frederikprijck
Copy link
Member

Released as 2.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

No branches or pull requests

2 participants