manfredsteyer / angular-oauth2-oidc

Support for OAuth 2 and OpenId Connect (OIDC) in Angular.
MIT License
1.9k stars 686 forks source link

Support for the new HttpClient of angular #77

Closed Tiagogv closed 7 years ago

Tiagogv commented 7 years ago

When are you going to add the new HttpClient of angular (angular/common/http) instead of angular/http ?

manfredsteyer commented 7 years ago

Hi,

it can already today be used together with the new HttpClient and it will very soon internally make use of it too.

Wishes, Manfred

bsh314 commented 7 years ago

This module requires Http & can not accept HttpClient. There is no mention to HttpClient in the code. This is the service constructor:

constructor( private http: Http, private urlHelper: UrlHelperService)

After OAuthModule import into AppModule, all of the components are giving this error: ERROR Error: No provider for Http!

Both modules can be imported at the same tiime, but they are large & there is no need for both of them.

manfredsteyer commented 7 years ago

Yes, that is right. For now, you also need the @angular/http package. It's currently a peer dependency.

But this does not prevent your application from using the HttpClient. When the new release of angular-oauth2-oidc uses HttpClient too, you can remove the dependency to @angular/http and save some bytes.

manfredsteyer commented 7 years ago

Scheduled for the next version. Will land next month.

@dalu Not sure. Seems like an extension for me. Beginning with 4.3 we have two Http Solutions in Angular. Using the older one is not necessarily an issue. But as it will be deprecated soon, it's really a good idea to switch over to the new one.

maxisam commented 7 years ago

@dalu Http is going to be deprecated in V5

manfredsteyer commented 7 years ago

Good point. That's also why I plan it for the next release that comes some days after Version 5. This will be a new major release as switching peer dependencies can be seen as a breaking change.

maxisam commented 7 years ago

btw, there is a library, angular2-jwt, taking care the interception part already. So I guess you just need to change Http to HttpClient.

manfredsteyer commented 7 years ago

thx!