芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/network.digitalhubbd.com/fns/hybridauth/Provider/QQ.php
isRefreshTokenAvailable()) { $this->tokenRefreshParameters += [ 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, ]; } $this->apiRequestParameters = [ 'access_token' => $this->getStoredData('access_token') ]; $this->apiRequestHeaders = []; } /** * {@inheritdoc} */ protected function validateAccessTokenExchange($response) { $collection = parent::validateAccessTokenExchange($response); $resp = $this->apiRequest($this->accessTokenInfoUrl); $resp = key($resp); $len = strlen($resp); $res = substr($resp, 10, $len - 14); $response = (new Data\Parser())->parse($res); if (!isset($response->openid)) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $this->storeData('openid', $response->openid); return $collection; } /** * {@inheritdoc} */ public function getUserProfile() { $openid = $this->getStoredData('openid'); $userRequestParameters = [ 'oauth_consumer_key' => $this->clientId, 'openid' => $openid, 'format' => 'json' ]; $response = $this->apiRequest($this->accessUserInfo, 'GET', $userRequestParameters); $data = new Data\Collection($response); if ($data->get('ret') < 0) { throw new UnexpectedApiResponseException('Provider API returned an error: ' . $data->get('msg')); } $userProfile = new Profile(); $userProfile->identifier = $openid; $userProfile->displayName = $data->get('nickname'); $userProfile->photoURL = $data->get('figureurl_2'); $userProfile->gender = $data->get('gender'); $userProfile->region = $data->get('province'); $userProfile->city = $data->get('city'); return $userProfile; } }