if(isset($this->session->token)) {
return true;
} elseif(strlen($this->session->state) > 0 AND $this->session->state == $request->getQuery('state') AND strlen($request->getQuery('code')) > 5) {
$client = $this->getHttpClient();
$client->setUri($this->options->getTokenUri());
$client->setMethod(Request::METHOD_POST);
$client->setHeaders(array('Accept-encoding' => 'utf-8'));
$client->setParameterPost(array(
'code' => $request->getQuery('code'),
'client_id' => $this->options->getClientId(),
'client_secret' => $this->options->getClientSecret(),
'redirect_uri' => $this->options->getRedirectUri()
));
$retVal = $client->send()->getContent();
parse_str($retVal, $token);