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 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 at 12:00
  • Are cookies disabled in your browser by any chance?
    – berliner
    Jan 7 at 12:02
  • @berliner thanks, but haven't found out anything useful from the issue. Also cookies are enabled in my browser. Jan 10 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.