Created
August 9, 2018 18:26
-
-
Save sairamkrish/46865a96a11d222c4a78123eb13d13d2 to your computer and use it in GitHub Desktop.
keycloak - angular integration - fetching user attributes example
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 { Component, OnInit } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
import { KeycloakService } from 'keycloak-angular'; | |
@Component({ | |
.... | |
}) | |
export class SomeComponent implements OnInit { | |
constructor(protected router: Router, | |
protected keycloakAngular: KeycloakService) { | |
} | |
ngOnInit() { | |
try { | |
let userDetails = this.keycloakAngular.getKeycloakInstance().tokenParsed["userDetails"]; | |
... | |
} catch (e){ | |
console.log('Failed to load user details', e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment