We have to upgrade Drupal 8.9 to Drupal 9.3.3; since the login_destination module stop working, and we don't know why, I've tried others modules like Anonymous Login, Redirect After Login, User Redirect but none of them seem to work.
In some sites, they commented that this redirect can be solved without modules but I don't know how.
Basically, what I am trying to do is to set the *destination" parameter in URL and let Drupal use that parameter to redirect users after they log in.
EDIT:
here is the solution:
function MODULE_user_login(AccountInterface $account) {
$response = new RedirectResponse($_GET['destination']);
$request = \Drupal::request();
// Save the session so things like messages get saved.
$request->getSession()->save();
$response->prepare($request);
// Make sure to trigger kernel events.
\Drupal::service('kernel')->terminate($request, $response);
$response->send();
}
we put this code in some other module (not login destination) and works fine ...
Thanks everybody
https://mywebsite.com/user/login?destination=/some-path
and it will redirect the user after login in to/some-path