0

In my Drupal 8 site, In the comment section, I have one button ("Add new comment"). Clicking on it will open a login pop up and user will be redirected to the same page. For that, I added the following code.

function my_custom_module_user_login($account) {
  $previousUrl = \Drupal::request()->server->get('HTTP_REFERER');
  $response = new Symfony\Component\HttpFoundation\RedirectResponse($previousUrl);
  $response->send();
  return;
}

How can I redirect the users to the front page, or any page, after they logged in via social sites? Is there any Drupal 8 that identifies when users logged in from the social networking sites?

Because of the above code, the login via social media is redirected to the same callback page.

enter image description here

If I remove the above code, the social media login redirects to the front page, but the login from comment doesn't redirect to the same page.

To login from social networks, I am using the OneAll Social Login module.

  • 1
    The OneAll Social Login module has settings for redirections, did you try to change them? – Ivan Tibezh May 13 at 10:34

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.