My site upgraded from Drupal 8.x to Drupal 9.2.4 (PHP 7.4). Once logout then login was not working. No error or warning, just page refresh happened. I checked the cookie compared with my old version, one of the cookies was not set after first login and logout.
The below image session is not set for second-time login.
Missing session image
I am not sure this is the problem, maybe.
I had the same issue. I am using my own redirect in hook_user_login(). After update from Drupal 9.1 to Drupal 9.2 my redirect stoped working (no login and no redirect). I found information on Drupal forum that 'redirect after login is breaking a basic contract of Drupal hooks, in that it is halting execution.' On the same forum I found suggestion to save session before sending a response, so I tried this on my code:
$response = new RedirectResponse($url->toString());
$request = \Drupal::request();
// Save the session so things like messages get saved.
$request->getSession()->save();
$response->prepare($request);
$response->send();
Source: https://www.drupal.org/project/redirect_after_login/issues/3214949#comment-14138959
升级到 9.2 后我遇到了同样的问题......会话已打开,但无法登录。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.