# Modify identity provider external ID for a User

**URL:** https://meta.discourse.org/t/modify-identity-provider-external-id-for-a-user/264379
**Category:** SSO
**Tags:** rest-api
**Created:** [May 9, 2023, 10:21am UTC](https://meta.discourse.org/t/modify-identity-provider-external-id-for-a-user/264379 "2023-05-09T10:21:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![SamSam](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@SamSam](https://meta.discourse.org/u/SamSam)
#### Post date: [May 9, 2023, 10:21am UTC](https://meta.discourse.org/t/modify-identity-provider-external-id-for-a-user/264379/1 "2023-05-09T10:21:43Z")

</div>

In case of a migration, I create users via API. We use Discourse-openid-connect for connecting to our SSO (Keycloak). I want to associate users account via API with ID from Keycloak. How a  
i can do this ?

I’ve seen the API /u/by-external/oidc/{ext\_id].json to get user info from external ID.  
I’ve also seen the API /u/{username}.json for update a User, and a field external\_ids. But i don’t know the value to put on…

---

<div class="post-metadata">

### Author: ![clayg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clayg/32/181131_2.png) [@clayg](https://meta.discourse.org/u/clayg)
#### Post date: [January 22, 2024, 1:34pm UTC](https://meta.discourse.org/t/modify-identity-provider-external-id-for-a-user/264379/2 "2024-01-22T13:34:23Z")

</div>

I have the same question but I haven’t found an answer yet. I too am creating new users via API and they login via OpenID. I can’t set their external\_ids when creating the user (it’s ignored) and my attempt to update the user with an external ID doesn’t make any change to the user’s record.

I’ll add though that I decided to use a custom user field (**user\_fields[1]**) to store my external ID and that works.
