# 공개 커뮤니티에서 자동 로그인 활성화?

**URL:** https://meta.discourse.org/t/auto-login-enabled-for-public-facing-community/223559
**Category:** Support
**Created:** [4월 7, 2022, 1:53오전 UTC](https://meta.discourse.org/t/auto-login-enabled-for-public-facing-community/223559 "2022-04-07T01:53:47Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![simonk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonk/32/247950_2.png) [@simonk](https://meta.discourse.org/u/simonk)
#### Post date: [4월 7, 2022, 8:50오전 UTC](https://meta.discourse.org/t/auto-login-enabled-for-public-facing-community/223559/4 "2022-04-07T08:50:52Z")

</div>

> [@BaneWilliams](#):
>
> 이상적인 세상에서는 계정이 있는 사용자가 Discourse를 볼 때 항상 로그인되어 있어야 하며, 이렇게 해야 모든 시청 데이터를 수집할 수 있습니다.

일반적인 경우 이는 불가능합니다(로그인을 요청하지 않고 익명 사용자에게 계정이 있는지 어떻게 알 수 있겠습니까?). 그러나 SSO 사이트에서 사용자가 이미 활성 세션을 가지고 있는지 감지하는 것은 가능해야 합니다.

> [@Detecting user already logged in when using SSO](https://meta.discourse.org/t/detecting-user-already-logged-in-when-using-sso/26968/9?u=simonk):
>
> So, have Discourse have a \</body\> script that goes like this: if (!Discourse.User.currentProp('username') { $.ajax(....., { .... dataType: "jsonp", success: function(xhr) { if (xhr.responseJSON.have\_account) { window.location = "/session/sso"; } } }); } It fails open - if the main site is down, the user can continue to browse as an anon on Discourse.

해당 주제는 꽤 오래되었지만, 원칙은 여전히 적용될 수 있다고 생각합니다. 기본적으로 적절한 CORS 지원을 갖춘 URL을 추가하여 사용자가 활성 세션을 가지고 있는지 여부를 나타내는 JSON 응답을 반환하도록 합니다. 그런 다음 Discourse 테마에 해당 URL을 쿼리하고 활성 세션이 존재하면 SSO 프로세스를 트리거하는 JS를 추가합니다.

---

_[View the full topic](https://meta.discourse.org/t/auto-login-enabled-for-public-facing-community/223559)._
