NullInjectorError: No provider for JwtHelperService!
Anil-bohorya opened this issue ยท 4 comments
Getting error in auth.service.ts
Error: StaticInjectorError(AppModule)[AuthService -> JwtHelperService]:
StaticInjectorError(Platform: core)[AuthService -> JwtHelperService]:
NullInjectorError: No provider for JwtHelperService!
at _NullInjector.get (core.js:994)
at resolveToken (core.js:1292)
at tryResolveToken (core.js:1234)
at StaticInjector.get (core.js:1102)
at resolveToken (core.js:1292)
at tryResolveToken (core.js:1234)
at StaticInjector.get (core.js:1102)
at resolveNgModuleDep (core.js:10836)
at _createClass (core.js:10881)
at _createProviderInstance$1 (core.js:10847)
Only issue I can spot is that HttpClientModule is not imported as per the usage notes.
Not sure if JwtHelper being private will cause this issue though. It is public on the example by module author.
Looks like it was removed here b025cf9 because it was not being used after imported.
My working config includes this:
HttpClientModule,
JwtModule.forRoot({
config: {
tokenGetter: tokenGetter ...
When do you receive this error? I cannot reproduce it neither in dev nor prod.
I only found this: https://stackoverflow.com/questions/44675373/error-error-no-provider-for-jwthelper
It is working Fine now.. I have taken fresh pull and installed. There are few changes in auth service and now JwtHelperService is replaced with JwtModule.
Thank you guys for all your valuable comments.