Not receiving webhook for logout

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.

1 Like

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.

1 Like