PATH:
home
/
lab2454c
/
keebchat.com
/
core
/
libs
/
oAuth
/
vendor
/
hybridauth
/
hybridauth
/
src
/
Provider
<?php /*! * Hybridauth * https://hybridauth.github.io | https://github.com/hybridauth/hybridauth * (c) 2017 Hybridauth authors | https://hybridauth.github.io/license.html */ namespace Hybridauth\Provider; use Hybridauth\Adapter\OAuth2; use Hybridauth\Exception\Exception; use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data\Collection; use Hybridauth\User\Profile; /** * Yandex provider adapter. * * Example: * * $config = [ * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), * 'keys' => ['id' => '', 'secret' => ''], * ]; * * $adapter = new Hybridauth\Provider\Yandex($config); * * try { * if (!$adapter->isConnected()) { * $adapter->authenticate(); * } * * $userProfile = $adapter->getUserProfile(); * } * catch(\Exception $e) { * print $e->getMessage() ; * } */ class Yandex extends OAuth2 { /** * {@inheritdoc} */ protected $apiBaseUrl = 'https://login.yandex.ru/info'; /** * {@inheritdoc} */ protected $authorizeUrl = 'https://oauth.yandex.ru/authorize'; /** * {@inheritdoc} */ protected $accessTokenUrl = 'https://oauth.yandex.ru/token'; /** * load the user profile from the IDp api client * * @throws Exception */ public function getUserProfile() { $this->scope = implode(',', []); $response = $this->apiRequest($this->apiBaseUrl . "?format=json"); if (!isset($response->id)) { throw new UnexpectedApiResponseException("User profile request failed! {$this->providerId} returned an invalid response.", 6); } $data = new Collection($response); if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new Profile(); $userProfile->identifier = $data->get('id'); $userProfile->firstName = $data->get('real_name'); $userProfile->lastName = $data->get('family_name'); $userProfile->displayName = $data->get('display_name'); $userProfile->photoURL = 'http://upics.yandex.net/' . $userProfile->identifier . '/normal'; $userProfile->profileURL = ""; $userProfile->gender = $data->get('sex'); $userProfile->email = $data->get('default_email'); $userProfile->emailVerified = $data->get('default_email'); if ($data->get('birthday')) { list($birthday_year, $birthday_month, $birthday_day) = explode('-', $response->birthday); $userProfile->birthDay = (int)$birthday_day; $userProfile->birthMonth = (int)$birthday_month; $userProfile->birthYear = (int)$birthday_year; } return $userProfile; } }
[-] Google.php
[edit]
[-] Foursquare.php
[edit]
[-] Blizzard.php
[edit]
[-] AOLOpenID.php
[edit]
[-] WordPress.php
[edit]
[-] WindowsLive.php
[edit]
[-] Telegram.php
[edit]
[-] OpenID.php
[edit]
[-] WeChat.php
[edit]
[+]
..
[-] Steam.php
[edit]
[-] GitLab.php
[edit]
[-] StackExchangeOpenID.php
[edit]
[-] Spotify.php
[edit]
[-] Paypal.php
[edit]
[-] Disqus.php
[edit]
[-] Twitter.php
[edit]
[-] ORCID.php
[edit]
[-] MicrosoftGraph.php
[edit]
[-] Dribbble.php
[edit]
[-] TwitchTV.php
[edit]
[-] LinkedIn.php
[edit]
[-] Facebook.php
[edit]
[-] Yandex.php
[edit]
[-] Instagram.php
[edit]
[-] Reddit.php
[edit]
[-] Authentiq.php
[edit]
[-] Discord.php
[edit]
[-] SteemConnect.php
[edit]
[-] YahooOpenID.php
[edit]
[-] Tumblr.php
[edit]
[-] Amazon.php
[edit]
[-] BitBucket.php
[edit]
[-] StackExchange.php
[edit]
[-] Yahoo.php
[edit]
[-] PaypalOpenID.php
[edit]
[-] BlizzardAPAC.php
[edit]
[-] BlizzardEU.php
[edit]
[-] Vkontakte.php
[edit]
[-] GitHub.php
[edit]
[-] WeChatChina.php
[edit]
[-] Mailru.php
[edit]
[-] Odnoklassniki.php
[edit]