/** * Login a user and return a JSON along with the authentication cookie. * * @return array * Array with the public fields populated. */ public function loginAndRespondWithCookie() { // Login the user. $account = $this->getAccount(); $this->loginUser(); $version = $this->getVersion(); $handler = restful_get_restful_handler('users', $version['major'], $version['minor']); $output = $handler ? $handler->viewEntity($account->uid) : array(); $output += restful_csrf_session_token(); return $output; }
/** * Get the CSRF token string. * * @return string * The token. */ public static function getCSRFTokenValue() { $token = array_values(restful_csrf_session_token()); return reset($token); }