I've recently migrated my application from Angular2 to Angular6
My build failed because of Angular2-JWT so I upgraded it to @auth0/angular-jwt
Now I'm stuck while updating my code as AuthHTTP and AuthConfig are deprecated.
I have a factory.ts for my security.module.ts. And I have to return a New AuthHttp to my security.module.ts.
export function AuthHttpServiceFactory( http: Http, options: RequestOptions) {
const accessToken = this.accessTokenService.getAccessToken();
const userInfoToken = this.accessTokenService.getUserInfoToken();
return new AuthHttp(
new AuthConfig({
tokenName: 'token',
tokenGetter: (() => accessToken),
globalHeaders: [{ 'Content-Type': 'application/json' }, { 'userinfotoken': userInfoToken }],
}), http, options);
}
Now I'm getting error while returning AuthHttp.
My Security.Module.ts is as follows.
@NgModule({
providers: [
LocalStorageService,
{
provide: AuthHttp,
useFactory: AuthHttpServiceFactory,
deps: [Http, RequestOptions]
}
]
})
I'm getting error at Provide : AuthHttp also.
Any help is appreciated.