# OIDC user mapping for first time login

**URL:** <https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069>\
**Category:** Getting advice\
**Tags:** authentication, identity-brokering, oidc\
**Created:** [April 21, 2022, 6:34am UTC](https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069 "2022-04-21T06:34:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lemoncalamitous](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/lemoncalamitous/32/5259_2.png) [@lemoncalamitous](https://forum.keycloak.org/u/lemoncalamitous)\
**Post date:** [April 21, 2022, 6:34am UTC](https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069/1 "2022-04-21T06:34:27Z")

</div>

Hi,

Is there a way to auto-populate (all) these fields when logging in using OIDC / identity provider the first time?  
 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/e/e242719b7eed99fd66dd49183a54fb811089c809.png)

I tried using mappers on my identity provider settings, but it doesn’t work.

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/3/3ec31b425c776dbd8c798bd36e58a5e6fe66340e.png)

Any help is much appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [April 21, 2022, 6:42am UTC](https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069/2 "2022-04-21T06:42:12Z")

</div>

The mapper approach is correct. You should be able to get the values for those fields from the IdP. Have you checked to see if you have requested the right scopes in your IdP setup (“Default Scopes”) such that you get those values? Usually, you will need `openid email profile`.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [April 21, 2022, 6:47am UTC](https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069/3 "2022-04-21T06:47:43Z")

</div>

And you probably don’t need the mappers if 1. the scopes are set properly, and 2. the IdP is compliant, as Keycloak will map those values automatically.

---

<div class="post-metadata">

**Author:** ![lemoncalamitous](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/lemoncalamitous/32/5259_2.png) [@lemoncalamitous](https://forum.keycloak.org/u/lemoncalamitous)\
**Post date:** [April 21, 2022, 12:37pm UTC](https://forum.keycloak.org/t/oidc-user-mapping-for-first-time-login/15069/4 "2022-04-21T12:37:02Z")

</div>

It seems that my identity provider configuration has no **Default Scopes** defined.  
After setting it to **email profile** and adding them as default client scopes on my realm, the user sync was successful (no update account information page anymore).

Thanks for the clues provided, especially on the _the scopes are set properly_ part. Much appreciated.
