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:----Ltj5ScVUiO/CtqLkybCO40p/xFl0lUnFNsvhT8zBGrqydA8rdPrxWM1QbidB8KjPPiTcgI/BXyCwG2t/ZsojWIO71fdxQnk8yiOb7OJ6kAdQFsVkpex2aTpEcEgS8AjmVzw1nuDUm7o/6NoI3DnHoO10RMBgbNRh3B6CTeRxUsuf/gVg8LL3d+8R43iwd6HqG39xnp5nopOSf4cmgWU4mnbI3r06PVLzYlsJsBFqdTC/u3WqVP0ZzSlOPGLQE2x21m8sh/Me3+GsfwUrvOB0qLoe/YXVKx4sW+d6DS+6GtlP3M5e969/Jn6uo6wUk3re1KFEAp2XUhgEWDWX+Uirz1FX93Z2BLiPXuNOGDnXkbP/ycPFhuFNjNoJgJCjf93wVoVIsOQSJ7lnETToCZU8tyLsyk8BG7VxJQN8Ymozq/jJcsXarddCGmkU7ufab/kbcSjWdh5NrVzXVNZGTq013pAN68hM7eOBttMp8YAE+lbo+NXS3SF4d0Owi/NaQp0E73UJi2vswFDeA04fVpymI9aTosLCgFcCllBxU2FLzik4PVcRlVT8sgKvNefgVW4XzPawmmSx4kcetPV2H206NouNiK0jOTFuIyiE9412o4n8kvfqg7t8CMpbp+RLmPvafb3l82xabYuOPfbFjJ7HPtdz5p8nbc7yO2hYz9p5vhI=----ATTACHMENT:----NzkwMzEzMDIzNjg0ODk2MSAyMTA2Nzk1NzA0NzgyMzg2IDIxMjIwMDg2ODk4OTk3NTA=