Skip to content

Instantly share code, notes, and snippets.

@sairamkrish
Created August 9, 2018 18:26
Show Gist options
  • Save sairamkrish/46865a96a11d222c4a78123eb13d13d2 to your computer and use it in GitHub Desktop.
Save sairamkrish/46865a96a11d222c4a78123eb13d13d2 to your computer and use it in GitHub Desktop.
keycloak - angular integration - fetching user attributes example
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