# 다른 웹사이트에서 Discourse에 사용자가 로그인되어 있는지 확인하는 방법

**URL:** https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185
**Category:** SSO
**Created:** [1월 10, 2024, 3:21오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185 "2024-01-10T15:21:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [1월 10, 2024, 3:21오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/1 "2024-01-10T15:21:30Z")

</div>

안녕하세요,

우리 웹사이트의 특정 페이지에 대한 접근을 비공개 Discourse에 멤버 계정이 있는지 여부에 따라 제한하고 싶습니다. 아마도 해당 페이지에서 사용자가 Discourse에 로그인되어 있는지 확인하는 방식으로 구현할 것 같습니다.

사용해야 할 적절한 도구는 다음과 같습니다: [GitHub - discourse/discourse-auth-proxy: An http proxy that uses the DiscourseConnect protocol to authenticate users](https://github.com/discourse/discourse-auth-proxy)

이를 사용하는 단계별 문서가 있을까요?

이 도구를 Discourse 사이트와 동일한 DigitalOcean 드롭렛에 설치할 수 있나요, 아니면 다른 곳에 호스팅해야 하나요?

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [7월 3, 2024, 3:03오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/2 "2024-07-03T15:03:41Z")

</div>

Discourse Auth Proxy 사용법에 대해 도움을 받을 수 있을까요?

Digital Ocean 드롭렛에 Discourse를 설치해 두고, PHP 웹사이트는 별도의 서버에서 운영 중입니다.

---

<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: [7월 3, 2024, 6:46오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/3 "2024-07-03T18:46:18Z")

</div>

> [@alehandrof](#):
>
> 우리 사설 Discourse에 회원 계정이 있는지 여부에 따라 웹사이트에서 특정 페이지에 대한 접근을 제한하고 싶습니다.

[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)(Discourse를 인증 제공자로 사용하는 방식)로 이를 수행할 수 있습니다: [Use Discourse as an identity provider (SSO, DiscourseConnect)](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974).

아직 직접 시도해 보지는 않았지만, `prompt` 매개변수가 당신의 경우에 유용할 수 있습니다:

> - `prompt`: `prompt=none`인 경우, SSO 요청은 단순히 “확인” 요청으로 처리됩니다. 브라우저/기기가 이미 Discourse에 로그인되어 있다면, Discourse는 평소와 마찬가지로 사용자 인증 정보를 포함한 성공적인 SSO 응답을 반환합니다. 브라우저/기기가 아직 로그인되어 있지 않다면, Discourse는 사용자에게 로그인을 요구하지 않고 사용자 정보 대신 `failed=true` 매개변수를 포함한 SSO 응답을 즉시 반환합니다. 이는 사용자가 로그인되어 있는지 여부를 확인하되, 로그인되어 있지 않은 경우 사용자를 로그인 대화상자로 유도하지 않는 메커니즘을 제공합니다.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [7월 3, 2024, 8:10오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/4 "2024-07-03T20:10:57Z")

</div>

이건 유망해 보이네요 @simon. `enable discourse connect`를 활성화하지 않아도 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)가 작동할 수 있다는 걸 몰랐는데, 실제로 가능하군요! 🤔

테스트를 좀 해보고 다시 알려드릴게요. 이 방향으로 이끌어주셔서 감사합니다!

---

<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: [7월 3, 2024, 9:28오후 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/5 "2024-07-03T21:28:13Z")

</div>

Discourse를 인증 제공자(auth provider)로 사용하는 것이 '[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)’라는 이름 때문에 간과되고 있는 건 아닌지 궁금합니다. 예를 들어, 여기 게시글에 `DiscourseConnect`라는 용어만 추가해도 Discourse의 외부 사이트 인증 제공자 사용에 관한 토픽으로 링크가 생성됩니다. \_Discourse\_를 인증 제공자로 사용하는 것은 제가 Discourse 사이트를 운영하는 주요 이유 중 하나입니다.

도움이 된다면, WordPress 플러그인은 Discourse가 인증 제공자로 기능할 수 있도록 합니다. 관련 코드는 여기 있습니다: [wp-discourse/lib/sso-client at main · discourse/wp-discourse · GitHub](https://github.com/discourse/wp-discourse/tree/main/lib/sso-client). 코드가 다소 복잡하게 작성되어 있을 수 있습니다.

더 직관적인 Remix/React 앱 구현 예시는 다음과 같습니다: [discourse\_remix\_comments/app/routes/login.tsx at main · scossar/discourse\_remix\_comments · GitHub](https://github.com/scossar/discourse_remix_comments/blob/main/app/routes/login.tsx). TypeScript 관련 부분을 무시하면 구현할 내용이 많지 않습니다.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [7월 23, 2024, 9:11오전 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/6 "2024-07-23T09:11:45Z")

</div>

@simon 답장을 남기며 감사의 뜻을 전하고 싶었습니다. 이전 제안을 정확한 해결책이라고 생각합니다. 제 사이트에서 구현하는 데 어려움을 겪고 있는데, 문제는 반쯤 커스터마이징된 CMS에 엉성하고 복잡한 코드가 많아 방해가 되고 있기 때문인 것 같습니다.

---

<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: [8월 22, 2024, 9:12오전 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/7 "2024-08-22T09:12:08Z")

</div>

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