Проблемы с авторизацией через Яндекс в HybridAuth

Добрый день!

У всех нормально работает авторизация через Яндекс в HybridAuth?

У меня с сегодняшнего дня (07.05.2020) начала вываливаться ошибка в логах:
[HybridAuth] Provider returned an error: invalid_scope Не удалось определить список запрашиваемых доступов
Соответственно Яндекс пишет:
Не удалось определить список запрашиваемых доступов (invalid_scope)
Проблема, по всей видимости, с GET-параметром scope, сейчас в нем передаются пустые данные "scope=". В документации указано «Если параметры scope и optional_scope не переданы, то токен будет выдан с правами, указанными при регистрации приложения.». Проверил, права в приложении указаны, но авторизация не проходит. Если в GET-параметре вручную указать "scope=login:birthday login:email login:info login:avatar", то авторизация проходит норм.

PS Ну соответственно слетела авторизация через Яндекс на всех моих сайтах.
Sphinx
07 мая 2020, 10:23
modx.pro
1
1 518
0

Комментарии: 3

Василий Наумкин
09 мая 2020, 14:59
1
+5
Мне кажется, это у Яндекса что-то сломалось и scope стал обязательным.

Указываем его в настройках вот так:
{"keys":{"id":"айди","secret":"пароль"},"scope":"login:birthday login:email login:info"}
То есть, id с паролем переехали в массив keys, и добавился параметр scope, где указано нужное.

Здесь уже починил.
    Sphinx
    13 мая 2020, 18:05
    0
    Спасибо Василий.

    PS Кстати, не успел внести у себя изменения, а авторизация заработала.
    Андрей
    09 мая 2020, 21:11
    0
    Аривет.
    А как правильно указать в этом файле
    <?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;
    	}
    }
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      3