question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method to return the user attributes that can be customized at the Keycloak's Admin console at the "Clients -> Select a Client -> Mappers" tab

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search for issues before submitting
- [X] feature request

Versions.

keycloak-angular:3.0.2 angular:6.0.0 keycloak:3.4.3 provided by Red Hat SSO:7.2.2 (RH SSO)

Repro steps.

Not applicable

The log given by the failure.

Not applicable

Desired functionality.

I did not found a method to return the user attributes that can be customized at the Keycloak’s Admin console at the “Clients -> Select a Client -> Mappers” tab. Only the basic attributes can be accessed using the KeycloakService.getKeycloakInstance().userInfo attributes.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
dsarceviccommented, Apr 18, 2019

@aniabraham I just faced same issue, managed to get attributes as suggested above:

      this.keycloakService.loadUserProfile().then(profile => {
        console.log(profile.username);
        console.log(profile['attributes']); //gives you array of all attributes of user, extract what you need
      })

3reactions
mauriciovigolocommented, Jul 24, 2018

@VSSILVA, for getting the custom user attributes you could get the attributes property from loadUserProfile method. For example:

let userDetails = await this.keycloakService.loadUserProfile();
console.log(this.userDetails.attributes.phone);

// another option with js destructuring
let {attributes} = await this.keycloakService.loadUserProfile();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom User Attributes with Keycloak - Baeldung
First, we'll select the Mapper Type as User Attribute and then set Name, User Attribute, and Token Claim Name as DOB. Claim JSON...
Read more >
Keycloak retrieve custom attributes to KeycloakPrincipal
Select Users > Lookup > click on ID > go to attributes tab > Add attribute > e.g.: phone > Save enter image...
Read more >
Server Administration Guide - Keycloak
Admin Console for central management of users, roles, role mappings, ... Token mappers - Map user attributes, roles, etc. how you want into ......
Read more >
Keycloak : Retrieve custom attributes in Access Token
Users can be created within a specific realm within the Administration console. Roles (permission types) can be defined at the realm level and...
Read more >
Chapter 8. Managing Clients Red Hat Single Sign-On 7.3
X.509 Client Certificate User Authentication ... Admin Console Access Control and Permissions ... You can hardcode roles, claims and custom attributes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found