Created
July 25, 2017 13:23
-
-
Save danielcrisp/e2f4f817f34c1f6621d29b3d575f2d1d to your computer and use it in GitHub Desktop.
AuthService - Async HTTP Interceptors with Angular 4
This file contains 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 { Injectable } from '@angular/core'; | |
import { UserManager, User } from 'oidc-client'; | |
@Injectable() | |
export class AuthService { | |
private userManager: UserManager; | |
constructor () { | |
this.userManager = new UserManager({ | |
// options | |
}); | |
} | |
getUser (): Promise<User> { | |
return this.userManager.getUser(); // <-- returns a Promise | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment