# 외부 사이트에서 로그인 시 Discourse에 SSO 로그인 이벤트 전송

**URL:** https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222
**Category:** Support
**Created:** [3월 23, 2020, 1:23오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222 "2020-03-23T13:23:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bvdrie72](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bvdrie72/32/158775_2.png) [@bvdrie72](https://meta.discourse.org/u/bvdrie72)
#### Post date: [3월 23, 2020, 1:23오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/1 "2020-03-23T13:23:02Z")

</div>

우리는 Discourse를 SSO와 함께 사용하고 있으며, 잘 작동하고 있습니다.

하지만 이상한 상황에 부딪혔습니다.

- 외부 사이트([paddling.com](http://paddling.com))에서 Discourse의 개인 메시지 링크를 사용하여 Discourse([forums.paddling.com](http://forums.paddling.com))에서 새로운 개인 메시지를 생성하고 있습니다.
- 사용자가 포럼에 로그인되어 있으면 예상대로 정확히 작동합니다.
- 사용자가 paddling.com에 로그인한 상태(포럼에 먼저 접속하지 않은 경우)에서 새 메시지를 생성하기 위해 링크를 클릭하면, 새 메시지가 생성되지 않고 단순히 포럼만 열립니다.
- 사용자가 메시지 링크를 두 번째로 클릭하면 메시지가 정상적으로 생성됩니다.

제 생각에는 사용자가 paddling.com에 로그인되어 있더라도, forums.paddling.com의 페이지를 실제로 열기 전까지는 포럼에는 로그인되어 있지 않은 것 같습니다.

과정을 확인하실 수 있도록 분류 광고 예시를 첨부합니다:  
[https://paddling.com/classifieds/trak-2-0-for-sale-747840/](https://paddling.com/classifieds/trak-2-0-for-sale-747840/)

외부 사이트([paddling.com](http://paddling.com))에서 로그인할 때 SSO 로그인([forums.paddling.com](http://forums.paddling.com))을 자동으로 실행할 수 있는 방법이 있을까요?

가능할 것 같은 참고 자료를 하나 찾았습니다:

> [@API를 통해 사용자 로그인하는 방법?](https://meta.discourse.org/t/how-to-login-a-user-via-api/134272/3):
>
> There’s a React Native app that you can use as a reference to find out how to login. This file in particular should help you get started.

---

<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월 23, 2020, 4:36오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/2 "2020-03-23T16:36:28Z")

</div>

> [@bvdrie72](#):
>
> - 사용자가 포럼에 로그인되어 있으면 정확히 예상대로 작동합니다.
> - 사용자가 [paddling.com](http://paddling.com)에 로그인한 경우(포럼에 먼저 접속하지 않은 상태)에 새 메시지를 생성하는 링크를 클릭하면, 새 메시지가 생성되지 않고 단순히 포럼만 열립니다.

여기에 설명된 방법을 사용할 수 있을 것입니다: [Creating pre-filled personal message links](https://meta.discourse.org/t/compose-a-new-pre-filled-personal-message-via-url/35984). `return_path`를 미리 채워진 개인 메시지 작성 화면으로 설정하여 사용해 보지는 않았지만, 작동하게 만들 수 있을 것 같습니다.

---

<div class="post-metadata">

### Author: ![bvdrie72](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bvdrie72/32/158775_2.png) [@bvdrie72](https://meta.discourse.org/u/bvdrie72)
#### Post date: [3월 24, 2020, 1:28오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/3 "2020-03-24T13:28:26Z")

</div>

> [@simon](#):
>
> 여기에 설명된 방법을 사용할 수 있습니다: [URL을 통해 미리 채워진 새 개인 메시지 작성](https://meta.discourse.org/t/compose-a-new-pre-filled-personal-message-via-url/35984).

미리 채워진 개인 메시지는 잘 작동합니다(사용자가 로그인된 상태라면). `return_path`를 사용하는 방법에 대해 개발팀에 확인해 보겠습니다.

---

<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월 24, 2020, 4:30오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/4 "2020-03-24T16:30:31Z")

</div>

> [@bvdrie72](#):
>
> 미리 채워진 개인 메시지는 정상적으로 작동합니다(사용자가 로그인된 상태인 한). `return_path`를 사용하는 부분에 대해 개발자에게 확인해 보겠습니다.

방금 이전 답변을 다시 읽어 보았습니다. 제가 말하고자 했던 것은 이 주제에 설명된 방식이 작동해야 한다는 것이었습니다: [SSO 로그인 링크 생성](https://meta.discourse.org/t/create-an-sso-login-link/109290). 이 방식은 저희 WordPress 플러그인이 Discourse로 사용자를 자동으로 로그인시키는 링크를 생성하는 데 사용됩니다. 아직 테스트하지 않은 부분은 `return_path`에 미리 채워진 메시지 URL을 설정하여 이 방식을 사용하는 것입니다.

여전히 명확하지 않다면 알려 주세요.

---

<div class="post-metadata">

### Author: ![bvdrie72](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bvdrie72/32/158775_2.png) [@bvdrie72](https://meta.discourse.org/u/bvdrie72)
#### Post date: [3월 24, 2020, 4:32오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/5 "2020-03-24T16:32:06Z")

</div>

@simon 설명해 주셔서 정말 감사합니다. 이제 훨씬 더 이해가 됩니다. 테스트해 보고 여기서 업데이트하겠습니다.

---

<div class="post-metadata">

### Author: ![bvdrie72](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bvdrie72/32/158775_2.png) [@bvdrie72](https://meta.discourse.org/u/bvdrie72)
#### Post date: [3월 24, 2020, 8:23오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/6 "2020-03-24T20:23:07Z")

</div>

@simon님께 빠른 업데이트 드립니다. 완벽하게 작동했습니다.

`https://forum.example.com/session/sso?return_path=https://forum.example.com/new-message?username=username%26title=title%26body=body+message`

도움 주셔서 감사합니다.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [4월 23, 2020, 8:23오후 UTC](https://meta.discourse.org/t/fire-sso-login-to-discourse-onlogin-on-external-site/145222/7 "2020-04-23T20:23:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
