On my dev environment hosted on the cloud which has SSL, I added this to the settings.php

$secure = true; // if you only want to receive the cookie over HTTPS
$httponly = true; // prevent JavaScript access to session cookie
$samesite = 'none';

if(PHP_VERSION_ID < 70300) {
  session_set_cookie_params($maxlifetime, '/; samesite='.$samesite, $_SERVER['HTTP_HOST'], $secure, $httponly);
} else {
    'lifetime' => $maxlifetime,
    'path' => '/',
    'domain' => $_SERVER['HTTP_HOST'],
    'secure' => $secure,
    'httponly' => $httponly,
    'samesite' => $samesite

My goal was to set SESSION cookie to samesite = 'NONE'.

Login was working when I did this on Drupal 8, but now on Drupal Core 9.3.0, when I login I get error message "To log in to this site, your browser must accept cookies from the domain [domain_name]"

enter image description here

  • My first take would be to search this string. Then you know the place in core where it comes from, and when. Then you can compare the code at this place to Drupal 8 on git.drupalcode.org.
    – leymannx
    Jan 7, 2022 at 11:00
  • Does this help? drupal.org/project/drupal/issues/2946 It's the issue where that error message has been introduced.
    – berliner
    Jan 7, 2022 at 12:00
  • Are cookies disabled in your browser by any chance?
    – berliner
    Jan 7, 2022 at 12:02
  • @berliner thanks, but haven't found out anything useful from the issue. Also cookies are enabled in my browser. Jan 10, 2022 at 6:37
  • Yes, same issue in Drupal 9.4.5 Sep 6, 2022 at 10:16

1 Answer 1


You get this error message when Drupal expects there to be a session, communicated by the check_logged_in, but none can be found.

I've found myself in this situation myself when a miss-configured web server stripped the cookies from the request.

The leads to Drupal setting up the session, and adding the query parameters, but the cookie not being present in subsequent requests. Drupal then displays the

your browser must accept cookies


Likely the cookie settings you are adding cause the cookie to become invalidated somehow, so double check that the browser actually sends the cookies, and that they reach Drupal.

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.