# Is there an endpoint to check if a user is logged in

**URL:** <https://meta.discourse.org/t/is-there-an-endpoint-to-check-if-a-user-is-logged-in/72780>\
**Category:** Development\
**Created:** [October 25, 2017, 6:26pm UTC](https://meta.discourse.org/t/is-there-an-endpoint-to-check-if-a-user-is-logged-in/72780 "2017-10-25T18:26:47Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)\
**Post date:** [January 20, 2020, 9:30pm UTC](https://meta.discourse.org/t/is-there-an-endpoint-to-check-if-a-user-is-logged-in/72780/17 "2020-01-20T21:30:29Z")

</div>

When the user is on the external app, they click a log-in button and get routed through Discourse’s SSO provider flow, and back to the external app. That external app can store a session with the user’s data. When the user logs out of Discourse, the webhook can delete the external app’s session. I’m not certain, but I think the webhook header is `X-Discourse-Event: user_logged_out`.

**Edit:** logging out from the external site is done with the [Discourse API](https://docs.discourse.org/#tag/Users/paths/~1admin~1users~1%7Bid%7D~1log_out/post).

Instead of asking Discourse whether a user is logged in, you can ask the external app. In my case it’s just for things like removing the log-in button in the external site.

I can double check my code later. I haven’t looked at it in a while, but I think it did something like that.

---

_[View the full topic](https://meta.discourse.org/t/is-there-an-endpoint-to-check-if-a-user-is-logged-in/72780)._
