Bonjour,

j'essauye d'implémtenter HybridAuth mais j'ai un problème de page blanche qui survient lors de la tentative de connexion
tAffichage du navigateur : [HTTP/1.1 500 Internal Server Error 2ms]

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
    URL de la requête : 	http://test.no-ip.biz/test/boutique/ext/api/hybridauth/index.php?hauth.start=Google&hauth.time=1446409521
    Méthode de la requête : 	GET
    Code d'état : 	HTTP/1.1 500 Internal Server Error
Des idées pour rechercher le problème ?

Merci


le lien :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <a href="<?php echo OSCOM::link('index.php', 'Account&SocialLogIn&Process&action=social_login&provider=Google', 'SSL', false); ?>"> google</a><br />

la class :

HybridAuthIdentiy


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
   <?php
    /**
     * HybridAuthIdentiy.php
     */
 
      namespace test\Sites\Shop;
 
      use test\OM\OSCOM;
      use test\OM\HTTP;
 
      class HybridAuthIdentity {
 
        const VERSION = '2.5.0';
    /**
    *
    * @var Hybrid_Auth
    */
        public $hybridAuth;
 
    /**
     *
     * @var Hybrid_Provider_Adapter
     */
        public $adapter;
 
    /**
     *
     * @var Hybrid_User_Profile
     */
        public $userProfile;
 
        public $allowedProviders = array('Google', 'Facebook', 'Linkedin', 'Live',);
 
        protected $config;
 
        Public function __construct() {
 
          require_once('ext/api/hybridauth/Hybrid/Auth.php');
 
          $this->config = array('base_url' =>  HTTP::TypeUrlDomain() . DIR_WS_HTTP_CATALOG . 'ext/api/hybridauth/index.php',
                                'providers' => array(
                                                      'Google' => array(
                                                                        'enabled' => true,
                                                                        'keys' => array(
                                                                                        'id' => "..........6lo2ije7io88e.apps.googleusercontent.com",
                                                                                        'secret' => "........5_paM6w",
                                                                                       ),
    //                                                                    'scope' => "https://www.googleapis.com/auth/userinfo.profile" . "https://www.googleapis.com/auth/userinfo.email",
    //                                                                    'access_type' => "online",
                                                                      ),
                                                      'Facebook' => array (
                                                                            'enabled' => true,
                                                                            'keys' => array (
                                                                                              'id' => 'facebook client id',
                                                                                              'secret' => 'facebook secret',
                                                                                            ),
                                                                            'scope' => 'email'
                                                                          ),
                                                      'Live' => array (
                                                                        'enabled' => true,
                                                                        'keys' => array (
                                                                                          'id' => 'windows client id',
                                                                                          'secret' => 'Windows Live secret',
                                                                                        ),
                                                                        'scope' => 'email'
                                                                      ),
                                                      'LinkedIn' => array(
                                                                            'enabled' => true,
                                                                            'keys' => array (
                                                                                              'key' => 'linkedin client id',
                                                                                              'secret' => 'linkedin secret',
                                                                                            ),
                                                                          ),
                                                    ),
 
                                'debug_mode' => true,
 
     // to enable logging, set 'debug_mode' to true, then provide here a path of a writable file
                                'debug_file' => '/home/www/......../boutique/temp/hybridAuth.txt',
                              );
 
 
 
          $this->hybridAuth = new \Hybrid_Auth($this->config);
 
          return $this->hybridAuth;
        }
 
    /**
    *
    * @param string $provider
    * @return bool
    */
        public function validateProviderName($provider) {
          if (!is_string($provider))
            return false;
          if (!in_array($provider, $this->allowedProviders))
            return false;
          return true;
        }
      }



SocialLogin

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  <?php
      /**
       * SocialLogin.php
       */
 
      namespace test\Sites\Shop\Pages\Account\Actions;
 
      use test\OM\OSCOM;
      use test\OM\Registry;
      use test\OM\HTML;
      use test\Sites\Common\Password;
 
      class SocialLogIn extends \test\OM\PagesActionsAbstract {
 
        public function execute() {
 
          if ( isset($_GET['action']) ) {
 
            if (!isset($_GET['provider']))  {
              OSCOM::redirect('index.php', null, 'SSL');
            }
 
            if ( $_GET['action'] == 'social_login' ) {
 
    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
              if (session_status() !== PHP_SESSION_ACTIVE) {
                if (!isset($_GET['cookie_test'])) {
                  $all_get = osc_get_all_get_params([
                                                      'Account',
                                                      'SocialLogIn',
                                                      'Process'
                                                    ]
                                                   );
                  OSCOM::redirect('index.php', 'Account&SocialLogIn&' . $all_get . (empty($all_get) ? '' : '&') . 'cookie_test=1', 'SSL');
                }
                OSCOM::redirect('index.php','Info&CookieUsage');
              }
            }
 
          } else {
            OSCOM::redirect('index.php', null, 'SSL');;
          }
        }
      }

L'Action

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
   <?php
      /**
       * Process.php
       */
 
      namespace test\Sites\Shop\Pages\Account\Actions\SocialLogIn;
 
      use test\OM\HTTP;
      use test\OM\OSCOM;
      use test\OM\Registry;
      use test\OM\HTML;
 
      class Process extends \test\OM\PagesActionsAbstract  {
 
        public function execute()  {
 
          $OSCOM_PDO = Registry::get('Db');
          $OSCOM_Customer = Registry::get('Customer');
          $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
          $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
          $OSCOM_HybridAuthIdentity = Registry::get('HybridAuthIdentity');
 
    // HybridAuth
 
          $provider = $_GET['provider'];
          $provider = @trim(strip_tags( $provider ));
 
          if (!$OSCOM_HybridAuthIdentity->validateProviderName($provider) ) {
            return OSCOM::redirect('index.php', null, 'SSL');
          }
 
          try{
 
 
    //Pb is here => when this line is executed, I have a whitepage
            $OSCOM_HybridAuthIdentity->adapter = $OSCOM_HybridAuthIdentity->hybridAuth->authenticate($provider);
 
 
 
            $user_profile = $OSCOM_HybridAuthIdentity->adapter->getUserProfile();
 
            if($user_profile && isset($user_profile->identifier)) {
 
              var_dump('<b>Name</b> :'.$user_profile->lastName.'<br>');
              exit;
            }
          }
          catch( Exception $e )
          {
            switch( $e->getCode() )
            {
              case 0 : echo 'Unspecified error.'; break;
              case 1 : echo 'Hybridauth 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 'Authentication 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 to authenticate again.';
                $OSCOM_HybridAuthIdentity->adapter->logout();
                break;
              case 7 : echo 'User not connected to the provider.';
                $OSCOM_HybridAuthIdentity->adapter>logout();
                break;
              case 8 : echo 'Provider does not support this feature.'; break;
            }
 
            echo '<br /><br /><b>Original error message:</b> ' . $e->getMessage();
 
            echo '<hr /><h3>Trace</h3> <pre>' . $e->getTraceAsString() . '</pre>';
          }
 
        }
      }

Le log :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Auth::initialize()
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth::initialize(). PHP version: 5.6.11-1ubuntu3.1
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth::initialize(). Hybrid_Auth version: 2.5.1
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth::initialize(). Hybrid_Auth called from: http://test.no-ip.biz/test_test_ui/boutique/index.php?Account&SocialLogIn&Process&action=social_login&provider=Google
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- PHP session.name diff from default PHPSESSID. http://php.net/manual/en/session.configuration.php#ini.session.name.
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth initialize. dump used config:  -- a:8:{s:8:"base_url";s:88:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php";s:9:"providers";a:4:{s:6:"Google";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:72:"179255733575-o7jrdnr5b9refjanhpq6lo2ije7io88e.apps.googleusercontent.com";s:6:"secret";s:24:"712NhQEnv6zK3JcY05_paM6w";}}s:8:"Facebook";a:3:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:18:"facebook client id";s:6:"secret";s:15:"facebook secret";}s:5:"scope";s:5:"email";}s:4:"Live";a:3:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:17:"windows client id";s:6:"secret";s:19:"Windows Live secret";}s:5:"scope";s:5:"email";}s:8:"LinkedIn";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:3:"key";s:18:"linkedin client id";s:6:"secret";s:15:"linkedin secret";}}}s:10:"debug_mode";b:1;s:10:"debug_file";s:59:"/home/www/test_test_ui/boutique/temp/hybridAuth.txt";s:9:"path_base";s:66:"/home/www/test_test_ui/boutique/ext/api/hybridauth/Hybrid/";s:14:"path_libraries";s:77:"/home/www/test_test_ui/boutique/ext/api/hybridauth/Hybrid/thirdparty/";s:14:"path_resources";s:76:"/home/www/test_test_ui/boutique/ext/api/hybridauth/Hybrid/resources/";s:14:"path_providers";s:76:"/home/www/test_test_ui/boutique/ext/api/hybridauth/Hybrid/Providers/";}
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth initialize. dump current session:  -- a:3:{s:36:"hauth_session.google.hauth_return_to";s:142:"s:133:"http://test.no-ip.biz/test_test_ui/boutique/index.php?Account&SocialLogIn&Process&action=social_login&provider=Google";";s:35:"hauth_session.google.hauth_endpoint";s:115:"s:106:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.done=Google";";s:39:"hauth_session.google.id_provider_params";s:545:"a:5:{s:15:"hauth_return_to";s:133:"http://test.no-ip.biz/test_test_ui/boutique/index.php?Account&SocialLogIn&Process&action=social_login&provider=Google";s:11:"hauth_token";s:26:"laq94onnh00gcdi5arci9rjjt1";s:10:"hauth_time";i:1446390642;s:11:"login_start";s:129:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.start=Google&hauth.time=1446390642";s:10:"login_done";s:106:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.done=Google";}";}
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth initialize: check if any error is stored on the endpoint...
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth initialize: no error found. initialization succeed.
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Auth::authenticate( Google )
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth::authenticate( Google ), User not connected to the provider. Try to authenticate..
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Auth::setup( Google ) --
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Auth::setup( Google ), no params given. Trying to get the stored for this provider. -- Array
    (
    [hauth_return_to] => http://test.no-ip.biz/test_test_ui/boutique/index.php?Account&SocialLogIn&Process&action=social_login&provider=Google
    [hauth_token] => laq94onnh00gcdi5arci9rjjt1
    [hauth_time] => 1446390642
    [login_start] => http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.start=Google&hauth.time=1446390642
    [login_done] => http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.done=Google
    )
 
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Provider_Adapter::factory( Google )
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00: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: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:"179255733575-o7jrdnr5b9refjanhpq6lo2ije7io88e.apps.googleusercontent.com";s:13:"client_secret";s:24:"712NhQEnv6zK3JcY05_paM6w";s:12:"redirect_uri";s:106:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?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;}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:"179255733575-o7jrdnr5b9refjanhpq6lo2ije7io88e.apps.googleusercontent.com";s:6:"secret";s:24:"712NhQEnv6zK3JcY05_paM6w";}}s:6:"params";a:5:{s:15:"hauth_return_to";s:133:"http://test.no-ip.biz/test_test_ui/boutique/index.php?Account&SocialLogIn&Process&action=social_login&provider=Google";s:11:"hauth_token";s:26:"laq94onnh00gcdi5arci9rjjt1";s:10:"hauth_time";i:1446390642;s:11:"login_start";s:129:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.start=Google&hauth.time=1446390642";s:10:"login_done";s:106:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.done=Google";}s:8:"endpoint";s:106:"http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.done=Google";s:4:"user";O:11:"Hybrid_User":3:{s:10:"providerId";s:6:"Google";s:9:"timestamp";i:1446391874;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;}}}
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Provider_Adapter::login( Google )
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter [Google]::logout()
    DEBUG -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Hybrid_Provider_Adapter::login( Google ), redirect the user to login_start URL. --
    INFO -- 127.0.0.1 -- 2015-11-01T15:31:14+00:00 -- Enter Hybrid_Auth::redirect( http://test.no-ip.biz/test_test_ui/boutique/ext/api/hybridauth/index.php?hauth.start=Google&hauth.time=1446391874, PHP )