# Configuring Angular2-JWT in Ionic 3 - Type Error

**URL:** <https://forum.ionicframework.com/t/configuring-angular2-jwt-in-ionic-3-type-error/88288>\
**Category:** ionic-v3\
**Created:** [April 29, 2017, 4:05am UTC](https://forum.ionicframework.com/t/configuring-angular2-jwt-in-ionic-3-type-error/88288 "2017-04-29T04:05:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karvanj](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@karvanj](https://forum.ionicframework.com/u/karvanj)\
**Post date:** [April 29, 2017, 4:05am UTC](https://forum.ionicframework.com/t/configuring-angular2-jwt-in-ionic-3-type-error/88288/1 "2017-04-29T04:05:42Z")

</div>

Hi everyone I am trying to configure my app.module to include Angular2-JWT. I’ve followed Angular2-jwt readme as well converting my storage.get to a promise but I get the following error:

`TypeError: StorageConstructor is not a constructor (evaluating 'new Storage()')`

Can anyone help me with setting this up properly? Thanks in advance.  
_Note I’ve also tried import storage but then get parameter error._

My code looks like this.

```auto
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { Http, HttpModule } from '@angular/http';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { IonicStorageModule } from '@ionic/storage';
import { AuthHttp, AuthConfig } from 'angular2-jwt';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { LoginPage } from '../pages/login/login';
import { ProfilePage } from '../pages/profile/profile';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { AuthService } from '../providers/auth/auth.service';
import { AuthResourceService } from '../providers/auth/auth-resource.service';
import { AlertService } from '../providers/alert/alert.service';

let storage = new Storage();

export function getAuthHttp(http) {
  return new AuthHttp(new AuthConfig({
    headerPrefix: 'JWT',
    noJwtError: true,
    globalHeaders: [{'Accept': 'application/json'}],
    tokenGetter: (() => storage.get('credential').then((val)=>{
      return val.token;
    })),
  }), http);
}

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    LoginPage,
    ProfilePage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    LoginPage,
    ProfilePage
  ],
  providers: [
    {
      provide: AuthHttp,
      useFactory: getAuthHttp,
      deps: [Http]
    },    
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    AuthService,
    AuthResourceService,
    AlertService
  ]
})
export class AppModule {}

```

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 29, 2017, 4:11am UTC](https://forum.ionicframework.com/t/configuring-angular2-jwt-in-ionic-3-type-error/88288/2 "2017-04-29T04:11:28Z")

</div>

See [angular2-jwt #323](https://github.com/auth0/angular2-jwt/issues/323).

---

<div class="post-metadata">

**Author:** ![karvanj](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@karvanj](https://forum.ionicframework.com/u/karvanj)\
**Post date:** [April 29, 2017, 10:01am UTC](https://forum.ionicframework.com/t/configuring-angular2-jwt-in-ionic-3-type-error/88288/3 "2017-04-29T10:01:07Z")

</div>

Awesome resolved thanks!
