12 require_once dirname(dirname(__FILE__)) .
'/EOAuth2Service.php';
20 protected $name =
'facebook';
21 protected $title =
'Facebook';
22 protected $type =
'OAuth';
23 protected $jsArguments = array(
'popup' => array(
'width' => 585,
'height' => 290));
25 protected $client_id =
'';
26 protected $client_secret =
'';
27 protected $scope =
'';
28 protected $providerOptions = array(
29 'authorize' =>
'https://www.facebook.com/dialog/oauth',
30 'access_token' =>
'https://graph.facebook.com/oauth/access_token',
36 $this->attributes[
'id'] = $info->id;
37 $this->attributes[
'name'] = $info->name;
38 $this->attributes[
'url'] = $info->link;
42 if (strpos($redirect_uri,
'?') !==
false) {
43 $url = explode(
'?', $redirect_uri);
44 $url[1] = preg_replace(
'#[/]#',
'%2F', $url[1]);
45 $redirect_uri = implode(
'?', $url);
48 $this->
setState(
'redirect_uri', $redirect_uri);
51 if (isset($_GET[
'js']))
52 $url .=
'&display=popup';
63 parse_str($response, $result);
72 $this->
setState(
'auth_token', $token[
'access_token']);
73 $this->
setState(
'expires', isset($token[
'expires']) ? time() + (
int)$token[
'expires'] - 60 : 0);
74 $this->access_token = $token[
'access_token'];
83 if (isset($json->error)) {
85 'code' => $json->error->code,
86 'message' => $json->error->message,