I just upgraded my Ionic app (3.9.1 & Angular 5). I’m getting an “illegal” constructor error because I’m trying to use storage with angular-jwt in app.module.
Is there another way of doing this? I need to make sure that tokenGetter retrieves the token so that it is sent along with every HTTP request.
app.module.ts
export function jwtOptionsFactory(storage) {
return {
tokenGetter: () => {
return storage.get('token');
},
whitelistedDomains: ['localhost:8080']
}
}
imports: [
BrowserModule,
IonicModule.forRoot(MyApp, {
}),
IonicStorageModule.forRoot(),
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [Storage] // Storage is a dependancy
}
})
],
providers: [
.........
Storage // I need to use Storage so I have to add it as a provider
]