I have this application with the structure below

I use the leisure client library https://github.com/philsturgeon/codeigniter-restclient to connect to MyAPI and using the php api client http://code.google.com/p/google-api-php-client/ to connect to google API
my controller code is below
function index()
{
if($this->form_validation->run())
{
$logged = $this->rest->get('auth/user',array(
'email'=>$this->input->post('email')
));
var_dump($logged);
}
$this->load->view('layout/login',$this->data);
}
and my API code that processes this request is below to make sure the user exists in my database and is authenticated through Google, as well
function user_get()
{
$response=NULL;
$data=array(
'email'=>$this->get('email')
);
$google_account=$this->google->authenticate();
if( isset($google_account) && $this->user_model->login($data))
{
$response->status='success';
$response->message=$google_account;
}
else
{
$response->status='error';
$response->message='Failed to authenticate user';
}
$this->response($response,200);
}
and the Googlelibrary function `Authenticate 'is below
function authenticate()
{
$oauth2 = new Google_Oauth2Service($this->client);
if (isset($_GET['code']))
{
$this->client->authenticate($_GET['code']);
$_SESSION['token'] = $this->client->getAccessToken();
$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
return;
}
if (isset($_SESSION['token']))
{
$this->client->setAccessToken($_SESSION['token']);
}
if (isset($_REQUEST['logout']))
{
unset($_SESSION['token']);
$this->client->revokeToken();
}
if ($this->client->getAccessToken())
{
$user = $oauth2->userinfo->get();
$_SESSION['token'] = $this->client->getAccessToken();
return $user;
}
else
{
$authUrl = $this->client->createAuthUrl();
redirect($authUrl);
}
}
URL-
http://localhost/hac_dc/api/auth/user/ahmed.samy.cs@gmail.com
JSON
i get response false . JSON MIME application/json,
, REST API, REST API,
, ,