0

I would like know how I can login my user to an external website after drupal-login please ?

I use :

    $xenAPI = new XenAPI('http://xen.dev/api.php', 'MY_API_KEY', 'MY_API_KEYSALT'); 
    $xenAPI->login('Kyna', 'secret_password', 'http://theming.dev');

The login work on all page when I use HOOK_user_load(), but if I use HOOK_user_login(), don't work. I don't have an error, but ->login() create a redirection with an header and I think drupal-login overwrite my header on external script or create a redirection before my script.

  • Yes, the login form has a redirection. See \Drupal\user\Form\UserLoginForm::submitForm() so you need to remove that redirection with $this->getRequest()->query->remove('destination') – user21641 Apr 19 '15 at 7:53
  • @IvanJaros that's an answer, please post it so. – user49 Aug 24 '15 at 20:52
  • @IvanJaros Could you write that as answer? – kiamlaluno Dec 21 '15 at 8:19
0

Yes, the login form has a redirection(see the \Drupal\user\Form\UserLoginForm::submitForm()), so you need to remove that redirection with $this->getRequest()->query->remove('destination').

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.