modxmodx-revolution

Login to many context in modx using api functions


I am working in facebook login, after successful facebook authentication i want to login user using modx api, i am able to login him using below code. But i am not getting how to login to multiple contexts, i tried to pass "login_context" parameter but still it only login him in "web" context and not other contexts.

 $c = array(
   'login_context' => 'tech,data,finance',
   'username' => $username,
   'password' => $password,
   'returnUrl' => 'http://www.mydomain.com',
 );
 $response = $modx->runProcessor('security/login', $c);

Solution

  • loginContext its for only one context, if you need to login to multiple contexts - use add_contexts option.