# Update user info on each Identity brokering

**URL:** <https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021>\
**Category:** Miscellanaeous\
**Tags:** identity-brokering\
**Created:** [April 7, 2020, 8:23am UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021 "2020-04-07T08:23:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrammyTraore](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/grammytraore/32/1319_2.png) [@GrammyTraore](https://forum.keycloak.org/u/GrammyTraore)\
**Post date:** [April 7, 2020, 8:23am UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/1 "2020-04-07T08:23:06Z")

</div>

Hello!

I use an Identity Broker for google in one of my OIDC clients.

I have problems keeping data from the users up to date with their google account. The workflow I want:

- “John Doe” logs into my app through the client which brokers to google (step OK)
- A user is created in keycloak db with firstName = “John” and lastName=“Doe” (step OK)
- “John Doe” changes his first name in his google account to “Johnny”
- “Johnny Doe” logs into my app through google (step OK)
- Step not working: Keycloak updates the user first name to “Johnny”

So my problem is that once a user is created through an Identity Provider, its info is never updated after that.

I tried adding some attribute mappers to force Keycloak doing it but it did not work.

Any idea if a configuration exists for it ? I could not find any in the documentation.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Robinyo](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Robinyo](https://forum.keycloak.org/u/Robinyo)\
**Post date:** [April 7, 2020, 8:36pm UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/2 "2020-04-07T20:36:08Z")

</div>

@GrammyTraore

When you setup an LDAP User Federation there are Sync Settings:

 ![Screen Shot 2020-04-08 at 07.15.49](https://global.discourse-cdn.com/free1/uploads/keycloak/original/1X/efa35710a294e9bf428126b6720cac52ba838d82.png)

However, that’s not the case for Identity Providers.

You might need to look at SCIM (System for Cross-domain Identity Management).

See:

- [Keycloak Community Newsletter #1](https://www.keycloak.org/2019/04/keycloak-newsletter-1.html)
- [SCIM 2](https://issues.redhat.com/browse/KEYCLOAK-2537)
- [SCIM-SDK](https://github.com/Captain-P-Goldfish/SCIM-SDK)

---

<div class="post-metadata">

**Author:** ![GrammyTraore](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/grammytraore/32/1319_2.png) [@GrammyTraore](https://forum.keycloak.org/u/GrammyTraore)\
**Post date:** [April 9, 2020, 8:40am UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/3 "2020-04-09T08:40:37Z")

</div>

Thanks for the answer !

I read about SCIM and I do not think it is the mecanism I need.

I only need a simple Identity Brokering which exists and works fine as is in Keycloak.  
The only problem I encounter is also encountered by other people (cf [https://stackoverflow.com/questions/57912634/update-keycloak-user-data-based-on-data-present-in-identity-provider-token/59640944](https://stackoverflow.com/questions/57912634/update-keycloak-user-data-based-on-data-present-in-identity-provider-token/59640944)).

When performing a connection through an Identity provider, the user data is not updated in Keycloak whereas it seems possible to have it done since the identity provider sends enough info.

---

<div class="post-metadata">

**Author:** ![Robinyo](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Robinyo](https://forum.keycloak.org/u/Robinyo)\
**Post date:** [April 9, 2020, 8:48pm UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/4 "2020-04-09T20:48:46Z")

</div>

It looks like you have two options:

- Sync the settings when a user signs in (i.e., extend Keycloak’s `OIDCIdentityProvider` to override the `updateBrokeredUser` method as per this Stack Overflow [answer](https://stackoverflow.com/a/58002033))
- Sync the settings periodically (e.g., a batch process that uses SCIM)

---

<div class="post-metadata">

**Author:** ![GrammyTraore](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/grammytraore/32/1319_2.png) [@GrammyTraore](https://forum.keycloak.org/u/GrammyTraore)\
**Post date:** [April 10, 2020, 8:21am UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/5 "2020-04-10T08:21:27Z")

</div>

Thanks again for the answer, I will look into what I can do and will post here if I succeed

---

<div class="post-metadata">

**Author:** ![arslivinski](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/arslivinski/32/1313_2.png) [@arslivinski](https://forum.keycloak.org/u/arslivinski)\
**Post date:** [August 28, 2020, 7:28pm UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/6 "2020-08-28T19:28:31Z")

</div>

I don’t know which version of Keycloak you are using, but on versions before 10 this is only possible if you change the source code, because the Keycloak don’t update the values from IdP at all, as you can see [here](https://github.com/keycloak/keycloak/blob/9.0.3/services/src/main/java/org/keycloak/broker/oidc/mappers/AbstractJsonUserAttributeMapper.java#L141).

But, on version 10 and onwards (KEYCLOAK-11862), was added an option to choose how to sync the attributes mapped on the Identity Provider, as described on the [docs](https://www.keycloak.org/docs/latest/server_admin/#_mappers).

---

<div class="post-metadata">

**Author:** ![GrammyTraore](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/grammytraore/32/1319_2.png) [@GrammyTraore](https://forum.keycloak.org/u/GrammyTraore)\
**Post date:** [August 31, 2020, 8:16am UTC](https://forum.keycloak.org/t/update-user-info-on-each-identity-brokering/2021/8 "2020-08-31T08:16:32Z")

</div>

Yes I recently upgraded keycloak to the last version and now benfit from teh new sync modes fot attributes

Thanks for your help !
