Created
December 27, 2018 15:39
-
-
Save argentinaluiz/1329ded1008ec5c0623c2586eb038fe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {BrowserModule} from '@angular/platform-browser'; | |
| import {NgModule} from '@angular/core'; | |
| import {JwtModule, JWT_OPTIONS} from '@auth0/angular-jwt'; | |
| export function jwtFactory(authService) { | |
| return { | |
| whitelistedDomains: [ | |
| new RegExp('localhost:8000/*'), | |
| ], | |
| tokenGetter: () => { | |
| return authService.getToken() | |
| } | |
| } | |
| } | |
| @NgModule({ | |
| declarations: [ | |
| ], | |
| imports: [ | |
| JwtModule.forRoot({ | |
| jwtOptionsProvider: { | |
| provide: JWT_OPTIONS, | |
| useFactory: jwtFactory, | |
| deps: [AuthService] | |
| } | |
| }) | |
| ], | |
| bootstrap: [AppComponent] | |
| }) | |
| export class AppModule { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment