I have tried far too many variations to list here, but the basic point is I cannot get the user logged in immediately after registration via Services. I have tried a fresh Drupal 7.33 install with only Services 7.x.3.11 enabled and the default resource settings provided by drupalgap 7.x.1.9
When I register using the Drupal interface, the user is created, the session opened, and I land on my profile page logged in.
vs.
When I call the Services endpoint /services/user/register.json
, Drupal creates the account but the session does not persist. See my screenshots below.
How can I either A. get the session to persist for subsequent Service resource calls OR B. hook to add the user's or auto-generated password back into the json response so I can programmatically resubmit the /login.json form client-side (which does persist) ?
This question how could the global $user be different between the Drupal interface and Services module? describes my same problem using LoginToboggan.
In my screenshot you'll see a debug line called "login debug". It comes from line 333 of "/sites/all/modules/logintoboggan/logintoboggan.module" where I've tried all of this to no avail...
function logintoboggan_process_login($account, &$edit, $redirect = array()){
global $user;
$user = user_load($account->uid);
//watchdog('login debug', json_encode($account));
watchdog('login debug', json_encode($edit));
//user_login_submit(array(), array('uid' => $account->uid));
user_login_finalize($edit);
// $user = user_load($account->uid);
// $user->token = drupal_get_token('services'); // WE HAVE A TOKEN ALTHOUGH I DOUBT THIS WOULD WORK IN TERMS OF SESSION PERSISTANCE
// user_login_finalize($edit);
// module_invoke_all('hook_user_login');
// module_invoke_all('tripchi_user_login');
// module_invoke_all('logintoboggan_user_login');