Hybridauth не правильно перенаправляет с помощью modx

Я пытаюсь заставить HybridAuth работать с Modx, но у меня много проблем, чтобы заставить его работать вообще, у меня это как мой тестовый скрипт:

<?php

$config = MODX_BASE_PATH . '/hybridauth/config.php';

require_once( MODX_BASE_PATH . '/hybridauth/Hybrid/Auth.php' );

$provider_name = 'Google';

try{

$hybridauth = new Hybrid_Auth($config);

$adapter = $hybridauth->authenticate($provider_name);

$social_profile = $adapter->getUserProfile();

$social_profile->provider = $provider_name;

print_r($_SESSION);

}catch( Exception $e ){

// Display the recived error,
// to know more please refer to Exceptions handling section on the userguide
switch( $e->getCode() ){
case 0 : echo "Unspecified error."; break;
case 1 : echo "Hybriauth configuration error."; break;
case 2 : echo "Provider not properly configured."; break;
case 3 : echo "Unknown or disabled provider."; break;
case 4 : echo "Missing provider application credentials."; break;
case 5 : echo "Authentification failed. ". "The user has canceled the authentication or the provider refused the connection.";
break;
case 6 : echo "User profile request failed. Most likely the user is not connected ". "to the provider and he should authenticate again.";
$twitter->logout();
break;
case 7 : echo "User not connected to the provider.";
$twitter->logout();
break;
case 8 : echo "Provider does not support this feature."; break;
}

// well, basically your should not display this to the end user, just give him a hint and move on..
echo "<br /><br /><b>Original error message:</b> " . $e->getMessage();
}

Кажется, начинает работать, но висит на URL-адрес запуска для hybridauth:

http://www.domain.com/hybridauth/?hauth.start=Google&hauth.time=1433210071

он не перенаправляет обратно на мой URL перенаправления, установленный в моем приложении Google:

http://www.domain.com/hybridauth/?hauth.done=Google

На самом деле, если даже не пытается войти в Google вообще [он должен перейти к форме входа в Google после того, как я очистить все куки браузера]

сейчас — вот отладочная информация, которую я получаю, но она выглядит хорошо, вплоть до того момента, когда она перенаправляет обратно вверх по стартовой ссылке ???

INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Auth::initialize()
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth::initialize(). PHP version: 5.4.38
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth::initialize(). Hybrid_Auth version: 2.4.1
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth::initialize(). Hybrid_Auth called from: http://www.my-domain.com/sso-testing/?provider=Google
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- PHP open_basedir is on. http://php.net/open-basedir.
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth initialize. dump used config:  -- a:8:{s:8:"base_url";s:38:"http://www.my-domain.com/hybridauth/";s:9:"providers";a:2:{s:6:"Google";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:72:"efw-fewef.apps.googleusercontent.com";s:6:"secret";s:24:"fewweafawefawgawgaweg";}}s:7:"Twitter";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:50:"76ef237-lIUjKK2fewefUgrb7MxUlNfbauylsfewefiivZ";s:6:"secret";s:45:"YEMARwefweyXUoDDX2gweweT";}}}s:10:"debug_mode";b:1;s:10:"debug_file";s:48:"/vhome/my-domain.com/core/cache/logs/error.log";s:9:"path_base";s:59:"/var/www/vhosts/my-domain.com/httpdocs/hybridauth/Hybrid/";s:14:"path_libraries";s:70:"/var/www/vhosts/my-domain.com/httpdocs/hybridauth/Hybrid/thirdparty/";s:14:"path_resources";s:69:"/var/www/vhosts/my-domain.com/httpdocs/hybridauth/Hybrid/resources/";s:14:"path_providers";s:69:"/var/www/vhosts/my-domain.com/httpdocs/hybridauth/Hybrid/Providers/";}
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth initialize. dump current session:  -- a:3:{s:36:"hauth_session.google.hauth_return_to";s:63:"s:55:"http://www.my-domain.com/sso-testing/?provider=Google";";s:35:"hauth_session.google.hauth_endpoint";s:64:"s:56:"http://www.my-domain.com/hybridauth/?hauth.done=Google";";s:39:"hauth_session.google.id_provider_params";s:364:"a:5:{s:15:"hauth_return_to";s:55:"http://www.my-domain.com/sso-testing/?provider=Google";s:11:"hauth_token";s:26:"u1mh0dafwefwefwefeeeeeeedhub200";s:10:"hauth_time";i:143wef357;s:11:"login_start";s:79:"http://www.my-domain.com/hybridauth/?hauth.start=Google&hauth.time=1433wef57";s:10:"login_done";s:56:"http://www.my-domain.com/hybridauth/?hauth.done=Google";}";}
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth initialize: check if any error is stored on the endpoint...
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth initialize: no error found. initialization succeed.
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Auth::authenticate( Google )
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth::authenticate( Google ), User not connected to the provider. Try to authenticate..
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Auth::setup( Google ) --
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Auth::setup( Google ), no params given. Trying to get the stored for this provider. -- Array
(
[hauth_return_to] => http://www.my-domain.com/sso-testing/?provider=Google
[hauth_token] => u1mxxxxxxxxxxxxhcgdhub200
[hauth_time] => 1433210357
[login_start] => http://www.my-domain.com/hybridauth/?hauth.start=Google&hauth.time=143xxxx357
[login_done] => http://www.my-domain.com/hybridauth/?hauth.done=Google
)

INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Provider_Adapter::factory( Google )
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Provider_Model::__construct( Google ) initialized. dump current adapter instance:  -- O:23:"Hybrid_Providers_Google":7:{s:5:"scope";s:132:"https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read https://www.google.com/m8/feeds/";s:10:"providerId";s:6:"Google";s:6:"config";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:72:"711xxx48437-drcxxxxxxxv2f1p2sdn.apps.googleusercontent.com";s:6:"secret";s:24:"saqkixxxxxYWmgJVDDh";}}s:6:"params";a:5:{s:15:"hauth_return_to";s:55:"http://www.my-domain.com/sso-testing/?provider=Google";s:11:"hauth_token";s:26:"u1mxxxxxxdhub200";s:10:"hauth_time";i:14xxxx357;s:11:"login_start";s:79:"http://www.my-domain.com/hybridauth/?hauth.start=Google&hauth.time=1xxxxx10357";s:10:"login_done";s:56:"http://www.my-domain.com/hybridauth/?hauth.done=Google";}s:8:"endpoint";s:56:"http://www.my-domain.com/hybridauth/?hauth.done=Google";s:4:"user";O:11:"Hybrid_User":3:{s:10:"providerId";s:6:"Google";s:9:"timestamp";i:143xxxx80;s:7:"profile";O:19:"Hybrid_User_Profile":22:{s:10:"identifier";N;s:10:"webSiteURL";N;s:10:"profileURL";N;s:8:"photoURL";N;s:11:"displayName";N;s:11:"description";N;s:9:"firstName";N;s:8:"lastName";N;s:6:"gender";N;s:8:"language";N;s:3:"age";N;s:8:"birthDay";N;s:10:"birthMonth";N;s:9:"birthYear";N;s:5:"email";N;s:13:"emailVerified";N;s:5:"phone";N;s:7:"address";N;s:7:"country";N;s:6:"region";N;s:4:"city";N;s:3:"zip";N;}}s:3:"api";O:12:"OAuth2Client":24:{s:12:"api_base_url";s:0:"";s:13:"authorize_url";s:41:"https://accounts.google.com/o/oauth2/auth";s:9:"token_url";s:42:"https://accounts.google.com/o/oauth2/token";s:14:"token_info_url";s:46:"https://www.googleapis.com/oauth2/v2/tokeninfo";s:9:"client_id";s:72:"7114xxxxx437-drcmhxxxxxtv2f1p2sdn.apps.googleusercontent.com";s:13:"client_secret";s:24:"saqxxxxxJVDDh";s:12:"redirect_uri";s:56:"http://www.my-domain.com/hybridauth/?hauth.done=Google";s:12:"access_token";s:0:"";s:13:"refresh_token";s:0:"";s:23:"access_token_expires_in";s:0:"";s:23:"access_token_expires_at";s:0:"";s:15:"sign_token_name";s:12:"access_token";s:11:"decode_json";b:1;s:13:"curl_time_out";i:30;s:21:"curl_connect_time_out";i:30;s:19:"curl_ssl_verifypeer";b:0;s:19:"curl_ssl_verifyhost";b:0;s:11:"curl_header";a:1:{i:0;s:21:"Authorization: OAuth ";}s:14:"curl_useragent";s:79:"OAuth/2 Simple PHP Client v0.1.1; HybridAuth http://hybridauth.sourceforge.net/";s:24:"curl_authenticate_method";s:4:"POST";s:10:"curl_proxy";N;s:9:"http_code";s:0:"";s:9:"http_info";s:0:"";s:11:"*response";N;}}
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Provider_Adapter::login( Google )
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter [Google]::logout()
DEBUG -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Hybrid_Provider_Adapter::login( Google ), redirect the user to login_start URL. --
INFO -- 184.144.81.222 -- 2015-06-01T21:59:40-04:00 -- Enter Hybrid_Auth::redirect( http://www.my-domain.com/hybridauth/?hauth.start=Google&hauth.time=14xxx0, PHP )

Кто-нибудь знает, что здесь происходит не так?

3

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector