# Not receiving webhook for logout

**URL:** https://meta.discourse.org/t/not-receiving-webhook-for-logout/213345
**Category:** Bug
**Created:** [December 29, 2021, 7:37am UTC](https://meta.discourse.org/t/not-receiving-webhook-for-logout/213345 "2021-12-29T07:37:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![allaeddine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/allaeddine/32/244611_2.png) [@allaeddine](https://meta.discourse.org/u/allaeddine)
#### Post date: [December 29, 2021, 7:37am UTC](https://meta.discourse.org/t/not-receiving-webhook-for-logout/213345/1 "2021-12-29T07:37:26Z")

</div>

I’ve set a hook to receive all events but I didn’t receive the logout event when I logged out from the drop down menu. However, I received the event when logged out using the API.

---

<div class="post-metadata">

### Author: ![allaeddine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/allaeddine/32/244611_2.png) [@allaeddine](https://meta.discourse.org/u/allaeddine)
#### Post date: [December 30, 2021, 4:18am UTC](https://meta.discourse.org/t/not-receiving-webhook-for-logout/213345/3 "2021-12-30T04:18:09Z")

</div>

Ok, after I looked in the source code, I found the following (I’m new to Ruby and Ember.js so please forgive any mistakes):  
The “logout” button in the user drop down menu (quick-access-profile.js) calls : `ajax(/session/${this.username}, { type: "DELETE" })` which corresponds to the “destroy” action in session\_controller.rb.  
I found that this actions doesn’t trigger the “user\_logged\_out” event. So after adding the following line :  
`DiscourseEvent.trigger(:user_logged_out, current_user)` to the “destroy” action, the “user\_logged\_out” webhook was triggered.

Is this a bug in “destroy” action of session\_controller.rb, or is it expected to not trigger the “user\_logged\_out” event ?

I’m using discourse as an SSO provider and trying to use the “user\_logged\_out” webhook to logout users on my website when they logout on discourse.
