diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php
index f6f216224623f159f6423a1c31683d60f9ca20d1..50fda636c5a28ed968ea15623d48b3a8c7a95c61 100644
--- a/modules/core/www/authenticate.php
+++ b/modules/core/www/authenticate.php
@@ -51,6 +51,6 @@ $t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
 
 $t->data['header'] = '{status:header_saml20_sp}';
 $t->data['attributes'] = $attributes;
-$t->data['logouturl'] = SimpleSAML_Utilities::selfURLNoQuery() . '?logout';
+$t->data['logouturl'] = SimpleSAML_Utilities::selfURLNoQuery() . '?as=' . urlencode($asId) . '&logout';
 $t->show();