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;
 }
 /**
  * Returns user profile
  *
  * Examples:
  *
  *	$data = $hybridauth->authenticate("Odnoklassniki")->getUserProfile();
  */
 public function getUserProfile($user = null)
 {
     $fields = ['uid', 'locale', 'first_name', 'last_name', 'name', 'gender', 'age', 'birthday', 'has_email', 'current_status', 'current_status_id', 'current_status_date', 'online', 'photo_id', 'pic_1', 'pic_2', 'pic1024x768', 'location', 'email'];
     $appKey = $this->getApplicationKey();
     $secret = $this->getApplicationSecret();
     $token = $this->getOdnoklassnikiAccessToken();
     $sig = md5('application_key=' . $appKey . 'fields=' . implode(',', $fields) . 'method=users.getCurrentUser' . md5($token . $secret));
     $parameters = ['application_key' => $appKey, 'method' => 'users.getCurrentUser', 'fields' => implode(',', $fields), 'sig' => $sig];
     // request user infos
     $response = $this->signedRequest('', Request::GET, $parameters);
     $response = json_decode($response);
     if (!isset($response->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($response, $this);
 }