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.

3
  • 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, 2015 at 7:53
  • @IvanJaros that's an answer, please post it so.
    – user49
    Aug 24, 2015 at 20:52
  • @IvanJaros Could you write that as answer?
    – apaderno
    Dec 21, 2015 at 8:19

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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