-
Notifications
You must be signed in to change notification settings - Fork 478
Closed
Description
Hi there, i'm using "@auth0/angular-jwt": "^4.0.0",.
I followed documentation:
https://github.com/auth0/angular2-jwt#configuration-for-ionic-2
But factory doesn't work.
Doesn't work with ionic storage neither localstorage.
export function jwtOptionsFactory(storage: Storage) {
return {
tokenGetter: () => {
// return storage.get('access_token');
return localStorage.getItem('access_token');
}
}
}
...
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [Storage]
}
}),
Without factory, it works fine:
export function tokenGetter() {
return localStorage.getItem('access_token');
}
...
JwtModule.forRoot({
config: {
tokenGetter: tokenGetter,
whitelistedDomains: endpoint.jwtWhitelist
}
}),