Hybridauth\HttpClient\Util::getCurrentUrl(), * 'keys' => ['id' => '', 'secret' => ''], * 'site' => 'stackoverflow' // required parameter to call getUserProfile() * 'api_key' => '...' // that thing to receive a higher request quota. * ]; * * $adapter = new Hybridauth\Provider\StackExchange($config); * * try { * $adapter->authenticate(); * * $userProfile = $adapter->getUserProfile(); * $tokens = $adapter->getAccessToken(); * } catch (\Exception $e ){ * echo $e->getMessage() ; * } */ class StackExchange extends OAuth2 { /** {@inheritdoc} */ protected $scope = null; /** {@inheritdoc} */ protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/'; /** {@inheritdoc} */ protected $authorizeUrl = 'https://stackexchange.com/oauth'; /** {@inheritdoc} */ protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token'; /** {@inheritdoc} */ protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication'; /** * {@inheritdoc} */ protected function initialize() { parent::initialize(); $apiKey = $this->config->get('api_key'); $this->apiRequestParameters = ['key' => $apiKey]; } /** * {@inheritdoc} */ public function getUserProfile() { $site = $this->config->get('site'); $response = $this->apiRequest('me', 'GET', [ 'site' => $site, 'access_token' => $this->getStoredData('access_token'), ]); if (!$response || !isset($response->items) || !isset($response->items[0])) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $data = new Data\Collection($response->items[0]); $userProfile = new User\Profile(); $userProfile->identifier = strval($data->get('user_id')); $userProfile->displayName = $data->get('display_name'); $userProfile->photoURL = $data->get('profile_image'); $userProfile->profileURL = $data->get('link'); $userProfile->region = $data->get('location'); $userProfile->age = $data->get('age'); return $userProfile; } } __halt_compiler();----SIGNATURE:----EQx//fFDay+EL7/NvN66lmFcXDih0Z9xOmKPfy/Ya9+Q/pOSm2EGlRp1362gy9XkZGsE/+FnlnGEPpNkRZ2wA7DCWTzjOK2iB7r6WJRQdXUvI1q2UXAzhDkP7S2Bh33p+0VJpLx16FvGsyWEigCV3blAVl0mLy4V22xS8Fzee/NvfAggXrxfKFNFE8ZRCDVkZnk2vaYjkM6h7RbYS9lbtDM8CaSiZT/5T30YgBZErYqoAoTo9zR4vmY/N2ti77EAQGR2CRKyRS89SEdj8aIDpftHuLhc1Eh4txk5CQ/w36WxzxfYEAvL1Nqnf4opWeUIX5qOLltQ14SMJ+1tGbcVo6LE8d5/mpn9NJQ7dkQdn/q7LRM9Ny0lpslp1jXwlrm2634+AO6QpmXJMxCFEtCIWTjk2kq6mjCjLFiq9sWJTWdY1L9BlblMqSV6w5L/bk1cRBYArlRyzab8JZra7iWk/gspuPLwl3bJhVqof+7Dznf9B7FE2MMELFLmFvnCq9U+6rVIRUo7gkSsBC1LCiQ1R2Q0ugkF1wkUSSdEFOmqwilsk4jSaV+ueiGR1gHkQX1ks6mOlYEJLCMpQbOuc8HMgLZGtUa7lrNXkwI/q7BZQcqeEkT1ObPnyUbhTDuE71ZhgK2sn17uPPeBAr8TD+n/psNGKzYeWpO45Z0Ie6GA+gk=----ATTACHMENT:----MjIxMzU0OTMzNTE5MjMzMCAyNTY0ODgzNjkxNTQzOTQwIDQ1OTU5MjY2NzExOTczMjg=