I was trying to make HybridAuth Social Login(version 2.6.0) work on this simple php site. Downloaded HybridAuth and installed it. Whenever I click the link to login to a social network (facebook) it redirects me to (MY_BASE_URL/index.php?hauth.start=Facebook&hauth.time) without showing any login window/error messages at all.
Here is the file for connexion:
$config ="../hybridauth/config.php";
require_once( "../hybridauth/Hybrid/Auth.php" );
try{$hybridauth = new Hybrid_Auth( $config );
$provider = @ trim( strip_tags( $_GET["provider"] ) );
$adapter = $hybridauth->authenticate( $provider );
$adapter = $hybridauth->getAdapter( $provider );
$user_data = $adapter->getUserProfile();
if($user_data)
{
print_r($user_data);
}
else
{
echo '******* CRASH *******';
exit;
}
}
catch( Exception $e ){
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 "Authentication failed. "
. "The user has canceled the authentication or the provider refused the connection.";
case 6 : echo "User profile request failed. Most likely the user is not connected "
. "to the provider and he should to authenticate again.";
$adapter->logout();
break;
case 7 : echo "User not connected to the provider.";
$adapter->logout();
break;
}
echo "<b>Original error message:</b> " . $e->getMessage();
echo "<hr /><h3>Trace</h3> <pre>" . $e->getTraceAsString() . "</pre>";
}
Here is the config file:
return
array(
"base_url" => "http://woonmako.com/hybridauth/index.php",
"providers" => array(
"Google" => array(
"enabled" => true,
"keys" => array("id" => "", "secret" => ""),
),
"Facebook" => array(
"enabled" => true,
"keys" => array("id" => "*********", "secret" => "***********"),
"trustForwarded" => false
),
"Twitter" => array(
"enabled" => true,
"keys" => array("key" => "", "secret" => ""),
"includeEmail" => false
),
),
"debug_mode" => false,
"debug_file" => "",
);
I would like to know how it's work and in which file I have to get user's information.
