示例#1
0
 public static function generateFromResponse($response, $adapter)
 {
     $page = parent::generateFromResponse($response, $adapter);
     $page->setPermissions(static::parser('perms', $response));
     $page->setAccessToken(static::parser('access_token', $response));
     $page->setCategory(static::parser('category', $response));
     return $page;
 }
示例#2
0
 /**
  * Returns user profile
  *
  * Examples:
  *
  *	$data = $hybridauth->authenticate("Vkontakte")->getUserProfile();
  */
 public function getUserProfile($user = null)
 {
     $parameters = ['fields' => 'first_name,last_name,nickname,screen_name,sex,' . 'bdate,timezone,photo_rec,photo_big,photo_max_orig, email'];
     // request user infos
     $response = $this->signedRequest('users.get', Request::GET, $parameters);
     $response = json_decode($response);
     $responseObj = new \stdClass();
     if (isset($response->response[0])) {
         $responseObj = $response->response[0];
     }
     if (!isset($responseObj->uid) || isset($response->error)) {
         throw new Exception('User profile request failed: Provider returned an invalid response. ' . 'HTTP client state:(' . $this->httpClient->getState() . ')', Exception::USER_PROFILE_REQUEST_FAILED, $this);
     }
     return Profile::generateFromResponse($responseObj, $this);
 }