diff -u b/deploy_services_client.client.inc b/deploy_services_client.client.inc --- b/deploy_services_client.client.inc +++ b/deploy_services_client.client.inc @@ -31,7 +31,7 @@ protected $loginCookie; /** - * The login cookie for session-based authentication. + * The CSRF token for session-based authentication. */ protected $tokenResponse; @@ -86,9 +86,8 @@ throw new DeployAuthenticationException(t('Authentication error: @code @error', array('@code' => $response->code, '@error' => $response->error))); } - // Store the login cookie so we can use it elsewhere. + // Store the login cookie and CSRF token so we can use them elsewhere. $response_data = drupal_json_decode($response->data); - if (!empty($response_data['session_name']) && !empty($response_data['sessid'])) { $this->endpoint->service_config['headers']['Cookie'] = $response_data['session_name'] . "=" . $response_data['sessid'] . ";"; // We have to get a CSFR Token from the server and pass along with @@ -119,13 +118,13 @@ } if ($this->debugEnabled()) { - watchdog('deploy', 'Session CSRF Token response: @response', array('@response' => print_r($token_response, TRUE)), WATCHDOG_DEBUG); + watchdog('deploy_services_client', 'Session CSRF Token response: @response', array('@response' => print_r($token_response, TRUE)), WATCHDOG_DEBUG); } - $this->endpoint->service_config['headers']['X-CSRF-Token'] = trim($token_response->data); - $this->loginCookie = $response->headers['set-cookie']; $this->tokenResponse = trim($token_response->data); + $this->endpoint->service_config['headers']['X-CSRF-Token'] = $this->tokenResponse; + return TRUE; } else {