# 다른 사용자의 SSO 기록에서 external\_id에 접근할 수 있는 방법이 있나요?

**URL:** <https://meta.discourse.org/t/is-there-a-way-we-can-access-the-external-id-from-sso-record-of-another-user/300989>\
**Category:** SSO\
**Created:** [3월 26, 2024, 12:43오후 UTC](https://meta.discourse.org/t/is-there-a-way-we-can-access-the-external-id-from-sso-record-of-another-user/300989 "2024-03-26T12:43:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [3월 26, 2024, 8:23오후 UTC](https://meta.discourse.org/t/is-there-a-way-we-can-access-the-external-id-from-sso-record-of-another-user/300989/3 "2024-03-26T20:23:15Z")

</div>

아래와 같은 방식으로 처리하면 될 것 같습니다:

```ruby
# 플러그인의 after_initialize 블록 안
after_initialize do

# 수정: `SiteSetting.enable_discourse_connect`가 `true`를 반환하는지 확인하는 것도 좋은 방법입니다.
  add_to_serializer(:user, :external_id) {object&.single_sign_on_record&.external_id}
end

```

`external_id`는 `user`의 속성이 아니라 `single_sign_on_record`의 속성입니다. 다음 코드를 다뤄본 적이 있어서 기억하고 있습니다:

> <https://github.com/discourse/discourse/blob/main/app/serializers/current_user_serializer.rb#L275-L281>

---

_[View the full topic](https://meta.discourse.org/t/is-there-a-way-we-can-access-the-external-id-from-sso-record-of-another-user/300989)._
