# Discourse에서 사용자를 프로그래밍 방식으로 로그아웃하기

**URL:** https://meta.discourse.org/t/programmatically-log-users-out-of-discourse/189104
**Category:** Support
**Created:** [5월 4, 2021, 7:39오전 UTC](https://meta.discourse.org/t/programmatically-log-users-out-of-discourse/189104 "2021-05-04T07:39:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Per\_Jacobsson1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/per_jacobsson1/32/202417_2.png) [@Per\_Jacobsson1](https://meta.discourse.org/u/Per_Jacobsson1)
#### Post date: [5월 4, 2021, 7:39오전 UTC](https://meta.discourse.org/t/programmatically-log-users-out-of-discourse/189104/1 "2021-05-04T07:39:41Z")

</div>

SSO를 사용할 때, WordPress에서 사용자가 삭제되면 Discourse에서 로그아웃되지 않는 것 같습니다.

이것은 제 환경에서 문제가 됩니다. Memberpress의 구독이 만료되거나 Memberpress/WordPress에서 사용자가 제거되면, 해당 사용자가 Discourse에 접근하지 못하게 하기를 원하기 때문입니다.

“wpdc\_sso\_provider\_before\_sso\_redirect” 훅을 사용하여 로그인 시점에 유효한 구독이 있는지 확인함으로써 로그인 시 접근을 차단할 수는 있습니다. 그러나 문제는 Discourse 세션이 영원히 유지되므로, 사실상 사용자가 로그아웃되지 않는다는 점입니다.

이 문제를 어떻게 해결할 수 있을까요?  
API 호출 등을 통해 Discourse에서 사용자를 로그아웃시키는 방법이 있을까요?

감사합니다!!  
Per

---

<div class="post-metadata">

### Author: ![Synesty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/synesty/32/218035_2.png) [@Synesty](https://meta.discourse.org/u/Synesty)
#### Post date: [5월 4, 2021, 8:41오전 UTC](https://meta.discourse.org/t/programmatically-log-users-out-of-discourse/189104/2 "2021-05-04T08:41:33Z")

</div>

이 섹션이 도움이 될 수 있습니다.

> [@Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)](https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045#heading--logoff):
>
> [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) is a core Discourse feature that allows you to configure “Single Sign-On (SSO)” to completely outsource all user registration and login from Discourse to another site. Offered to our [pro, business and enterprise hosting customers](https://discourse.org/pricing). information_source (Feb 2021) ‘[Discourse SSO](https://meta.discourse.org/t/13045?silent=true)’ is now ‘[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)’. If you are running an old version of Discourse, the settings below will be named sso\_... rather than discourse\_connect\_... The Problem Many sites wishing to integrate wit…
