we are implementing a custom login (based on an auth cookie given by a third party authentication service). When the cookie arrives, we trigger the drupal user_login. When the user logs out (via a custom box, NOT drupal logout link), we trigger the user_logout.

The problem is: if you clear the cookie auth, you remain logged on drupal. What hook can we implement to trigger the logout anytime the cookie auth disappear?


1 Answer 1


There is no hook for 3rd party cookie removal, and there cannot be. You need to bootstrap Drupal and call user_logout().

You could also use hook_boot() to test for the cookie and logout if it's not there, but it is a bad idea - it may seriously hurt your performance and will not play nice with external caches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.