# Find user by external ID (SSO)

**URL:** https://meta.discourse.org/t/find-user-by-external-id-sso/18330
**Category:** Feature
**Created:** [7월 31, 2014, 8:06오후 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330 "2014-07-31T20:06:26Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![michael28](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael28/32/33744_2.png) [@michael28](https://meta.discourse.org/u/michael28)
#### Post date: [7월 31, 2014, 8:06오후 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/1 "2014-07-31T20:06:26Z")

</div>

For those of us making use of SSO, being able to find a user by their external ID would be very helpful. It would make linking profiles etc. much more straightforward in cases where username requirements may not fully map 1:1.

From my current understanding, external\_id isn’t currently stored in the User model, but is passed as part of the payload. Could this data also be saved to the user model directly?

---

<div class="post-metadata">

### Author: ![michael28](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael28/32/33744_2.png) [@michael28](https://meta.discourse.org/u/michael28)
#### Post date: [7월 31, 2014, 8:10오후 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/2 "2014-07-31T20:10:49Z")

</div>

Did some further digging - storing external\_id is probably redundant as it’s stored in SingleSignOnRecord. Perhaps it would make more sense to add an API endpoint could be added to convert the external\_id to user\_id?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [8월 1, 2014, 1:37오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/3 "2014-08-01T01:37:14Z")

</div>

I agree with this can we make sure it is on the SSO todo list @sam?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [8월 1, 2014, 2:02오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/4 "2014-08-01T02:02:18Z")

</div>

This exists now as its a custom\_field, will see if I can add a find user by custom field general route.

---

<div class="post-metadata">

### Author: ![depeters](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/depeters/32/137579_2.png) [@depeters](https://meta.discourse.org/u/depeters)
#### Post date: [3월 10, 2015, 4:59오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/5 "2015-03-10T04:59:57Z")

</div>

I found it: users/by-external/:external\_id

---

<div class="post-metadata">

### Author: ![sascha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sascha/32/71383_2.png) [@sascha](https://meta.discourse.org/u/sascha)
#### Post date: [4월 28, 2017, 1:16오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/6 "2017-04-28T01:16:35Z")

</div>

Where would I find documentation for this? I’m looking to find users by external\_email or external\_username.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [4월 28, 2017, 2:59오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/7 "2017-04-28T02:59:12Z")

</div>

I’m not sure any formal documentation exists. What exactly are you looking to do? A specific example would make it much easier to provide you with the details (or link to a topic) that you need.

---

<div class="post-metadata">

### Author: ![sascha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sascha/32/71383_2.png) [@sascha](https://meta.discourse.org/u/sascha)
#### Post date: [4월 28, 2017, 3:18오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/8 "2017-04-28T03:18:29Z")

</div>

We may have a bit of an unusual scenario but we’d like to integrate Discourse into multiple separate instances of our webapp, so effectively we have lots of IdPs and only one single Discourse instance.

These users have different external\_ids but the same email address. Discourse will look up users by external\_id and if not found will look them up by the email address and update the external\_id if found.

This effectively makes discourse merge our external users, which is very nice, making the email address the only unique identifier as the external\_id in discourse changes. To fetch notifications we’d like to look up a user by the external email address as the external\_id does not necessarily match any more.

Is this possible?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [4월 28, 2017, 3:23오전 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/9 "2017-04-28T03:23:29Z")

</div>

That’s beyond my SSO knowledge, sorry.

I saw that you made a dedicated #dev:sso topic very similar to this, as this question is related, I’d suggest coalescing all discussion in one topic.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [11월 10, 2020, 2:31오후 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/10 "2020-11-10T14:31:54Z")

</div>

이 기능은 이미 일찍부터 사용할 수 있었습니다. 자세한 내용은 아래를 참고하세요.

> [@ID 제공자의 '외부 ID'로 사용자 찾기](https://meta.discourse.org/t/find-a-user-by-their-identity-provider-external-id/169723?u=david):
>
> bookmark 이 가이드는 API 호출을 사용하여 ID 제공자의 external\_id를 기반으로 Discourse 사용자를 찾는 방법을 설명합니다. person_raising_hand 필요한 사용자 권한: 관리자 외부 인증 시스템을 사용할 때, Discourse는 두 가지 사용자 ID를 추적합니다: Discourse의 user\_id와 ID 제공자의 external\_id입니다. external\_id를 기반으로 Discourse 사용자를 조회해야 하는 경우, 이 #howto(사용법) 글이 적합합니다! 아래에서 이 작업을 수행하는 방법을 배울 수 있습니다. API 설정 먼저, 관리자 API 키가 올바르게 구성되었는지 확인하십시오. Discourse API 설정 및 사용에 대한 자세한 내용은 [Discourse API 문서](https://meta.discourse.org/t/discourse-api-documentation/22706)를 참고하십시오. [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)(구 [Discourse SSO](https://meta.discourse.org/t/13045?silent=true))를 사용 중인 경우, 다음 API 호출로 사용자…

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [11월 10, 2020, 2:31오후 UTC](https://meta.discourse.org/t/find-user-by-external-id-sso/18330/11 "2020-11-10T14:31:58Z")

</div>


