My Discourse site is set up as the SSO provider for my WordPress site. Since login / logout on Discourse doesn’t automatically sync to WordPress, I’m writing a Discourse plugin to do that. I found a way to catch the logout event from here: https://github.com/discourse/discourse/blob/b404a4b97c41953cfd35c51b38068338b918831d/app/models/user.rb#L909, but the log_in method below doesn’t publish to message bus, is there a way to catch login event at all?
Another question, during /logout event, I can send an AJAX request to logout in WP, but the AJAX request gets canceled because logout causes a page refresh before the request is completed, is there a way to tell discourse to wait for a Promise/Deferred to complete before proceed?
Thanks!