Permalink
Browse files

Now takes into account access tokens with no expiry. Fixes #2

  • Loading branch information...
1 parent 7cc5ad5 commit 4a709522bb50fd049f20b5d16f4baeb84c6716eb Chris Harvey committed Jan 30, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 libraries/facebook.php
View
@@ -224,11 +224,16 @@ public function get_access_token()
$curl = $this->curl_call('get', $call_url);
$token = parse_str($curl);
- if(isset($access_token) || isset($expires))
+ if(isset($access_token) && isset($expires))
{
$this->set_access_token($access_token, $expires);
return $this->_CI->session->userdata("facebook_access_token");
}
+ elseif(isset($access_token) && !isset($expires))
+ {
+ $this->set_access_token($access_token);
+ return $this->_CI->session->userdata("facebook_access_token");
+ }
else
{
return FALSE;
@@ -242,9 +247,16 @@ public function get_access_token()
}
}
- public function set_access_token($access_token, $expires)
+ public function set_access_token($access_token, $expires = FALSE)
{
- $this->_CI->session->set_userdata('facebook_access_token', array("token" => $access_token, "expires" => $expires));
+ if($expires != FALSE)
+ {
+ $this->_CI->session->set_userdata('facebook_access_token', array("token" => $access_token, "expires" => $expires));
+ }
+ else
+ {
+ $this->_CI->session->set_userdata('facebook_access_token', array("token" => $access_token));
+ }
}
public function set_redirect_uri($redirect_uri)

0 comments on commit 4a70952

Please sign in to comment.