Для Яндекса еще проще 1) Идем сюда: oauth.yandex.ru/client/new ? Название: mysite.com Яндекс.Логин: выбираем все Callback URI:
http://mysite.com/assets/components/modhybridauth/connectors/profile/auth.php?hauth.done=Yandex
Жмем "Создать" Получили: ? 2) Идем в phpMyAdmin и в таблице modx_modhybridauth_providers копируем запись Google. Ставим в поле id значение 4, в поле name Google заменяем на Yandex, в поле keys в id подставляем Id приложения, в secret — Пароль приложения. 3) Открываем Modx SDK и в ShopModxBox-1.1.0-beta -> Media Sources -> modHybridAuth core -> model -> modhybridauth -> Hybrid -> щелкаем правой кнопкой мышки на папке Providers -> «Быстро создать файл» Имя: Yandex.php Содержимое:
<?php /*! * HybridAuth * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth * © 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html * * Provider writed by xbreaker | https://github.com/xbreaker/hybridauth */ /** * Hybrid_Providers_Yandex provider adapter based on OAuth2 protocol * */ class Hybrid_Providers_Yandex extends Hybrid_Provider_Model_OAuth2 { /** * IDp wrappers initializer */ function initialize() { parent::initialize(); // Provider apis end-points $this->api->api_base_url = "https://login.yandex.ru/info"; $this->api->authorize_url = "https://oauth.yandex.ru/authorize"; $this->api->token_url = "https://oauth.yandex.ru/token"; $this->api->sign_token_name = "oauth_token"; } /** * load the user profile from the IDp api client */ function getUserProfile() { $response = $this->api->api( "?format=json" ); if ( ! isset( $response->id ) ){ throw new Exception( "User profile request failed! {$this->providerId} returned an invalide response.", 6 ); } $this->user->profile->identifier = (property_exists($response,'id'))?$response->id:""; $this->user->profile->firstName = (property_exists($response,'real_name'))?$response->real_name:""; $this->user->profile->lastName = (property_exists($response,'family_name'))?$response->family_name:""; $this->user->profile->displayName = (property_exists($response,'display_name'))?$response->display_name:""; $this->user->profile->photoURL = 'http://upics.yandex.net/'. $this->user->profile->identifier .'/normal'; $this->user->profile->profileURL = ""; $this->user->profile->gender = (property_exists($response,'sex'))?$response->sex:""; $this->user->profile->email = (property_exists($response,'default_email'))?$response->default_email:""; $this->user->profile->emailVerified = (property_exists($response,'default_email'))?$response->default_email:""; if( property_exists($response,'birthday') ){ list($birthday_year, $birthday_month, $birthday_day) = explode( '-', $response->birthday ); $this->user->profile->birthDay = (int) $birthday_day; $this->user->profile->birthMonth = (int) $birthday_month; $this->user->profile->birthYear = (int) $birthday_year; } return $this->user->profile; } }
4) Идем во вкладку «Элементы» и выбираем чанк dbt.lgnLoginTpl? Добавляем ссылку
<a href="[[++assets_url]]components/modhybridauth/connectors/profile/auth.php?provider=Yandex&redirect_id=104" alt="Yandex" title="Войти через Яндекс" class="social Yandex"></a>
5) На всякий случай я почистил кэш
У меня без бубнов заработало