diff --git a/modules/consent/lib/Consent/Store/Cookie.php b/modules/consent/lib/Consent/Store/Cookie.php
index 4d5d1f0d308a19da4feb793f2e6d4b40d21150cd..d9b9d0a133db9eedefdc74e9f257e36b8fd967fe 100644
--- a/modules/consent/lib/Consent/Store/Cookie.php
+++ b/modules/consent/lib/Consent/Store/Cookie.php
@@ -275,18 +275,12 @@ class sspmod_consent_Consent_Store_Cookie extends sspmod_consent_Store
 
         $globalConfig = SimpleSAML_Configuration::getInstance();
         $params = array(
-            'lifetime' => (90*24*60*60),
+            'lifetime' => 7776000,    // (90*24*60*60)
             'path' => ($globalConfig->getBasePath()),
-            'httponly' => false,
+            'httponly' => true,
+            'secure' => \SimpleSAML\Utils\HTTP::isHTTPS(),
         );
 
-        if (\SimpleSAML\Utils\HTTP::isHTTPS()) {
-            // Enable secure cookie for https-requests
-            $params['secure'] = true;
-        } else {
-            $params['secure'] = false;
-        }
-
         \SimpleSAML\Utils\HTTP::setCookie($name, $value, $params, false);
     }
 }