Created
January 24, 2019 13:08
-
-
Save wtrocki/99244f15408b62d46b76c85b94ad4859 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
| public getHeaderProvider(tokenUpdateTime: number) { | |
| const headerProvider = () => { | |
| const tokenUpdate = this.extract().updateToken(tokenUpdateTime) as any; | |
| // Keycloak doesn't use a proper promise. Instead it uses success and error. | |
| return new Promise((resolve, reject) => { | |
| tokenUpdate.success(() => { | |
| resolve({ "Authorization": "Bearer " + this.extract().token }); | |
| }).error((error: any) => { | |
| // tslint:disable-next-line:no-console | |
| console.info("Cannot update keycloak token", error); | |
| reject(error); | |
| }); | |
| }); | |
| }; | |
| return headerProvider; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment