Example #1
0
 public function getProfileImage($id = 'me')
 {
     $config = Config::get('social-connect::config.' . $this->type);
     if (!$this->hasAccessToken()) {
         return ['message' => 'No Access Token, login first.', 'for' => 'facebook.get_profile', 'type' => 'error'];
     } else {
         $chainable = Chainable::make($this->payloadGraph . '/' . $id . '/picture')->setAttrib('access_token', $this->getAccessToken());
         return $chainable->getURI();
     }
 }
Example #2
0
 public function getAccessToken($code = null, $redirect_uri = null)
 {
     if ($this->hasAccessToken()) {
         return $this->session->get($this->type . '.access_token');
     }
     $config = $this->config->get('social-connect::config.' . $this->type);
     $chainable = Chainable::make($this->payloadGraph . "/oauth/access_token");
     $chainable->setAttrib('client_id', $config['app_id'])->setAttrib('type', 'web_server')->setAttrib('response_type', 'token')->setAttrib('client_secret', $config['app_secret'])->setAttrib('redirect_uri', $redirect_uri)->setAttrib('code', $code);
     $contents = file_get_contents($chainable->getURI());
     $contents = explode('access_token=', $contents);
     $this->setAccessToken($contents[1]);
     return $contents[1];
 }