I am currently using hybridauth for the integration of social login in a website. The websites url is find.pk. I have added Facebook, Twitter, Google+ and Microsoft login in the site and they work perfectly. But the linkedin one just redirects me to the hybridauth root page after taking username and password. Means here: find.pk/public/social/hybridauth
this is also defined as the base url the config file.
ROOT / public / social / hybridauth / ( The path of the hybridauth lib )
and
ROOT / pubilc / social / all.php?login={whateverprovider} ( To authenticate using any provided e.g facebook, twitter etc. )
You can see the live demo for linkedin login problem:
find.pk/public/social/all.php?login=linkedin
all.php code:
<?php
session_start();
if (isset( $_GET['login'] ))
{
switch ($_GET['login']) {
case 'facebook':
// Now Login with facebook
$config = "hybridauth/config.php";
require_once( "hybridauth/Hybrid/Auth.php" );
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "Facebook" );
$user_profile = $adapter->getUserProfile();
$user_profile = json_decode(json_encode( $user_profile ));
$_SESSION['social_profile'] = $user_profile;
header("Location: http://find.pk/user/social_got");
exit;
break;
case 'twitter':
$config = "hybridauth/config.php";
require_once( "hybridauth/Hybrid/Auth.php" );
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "Twitter" );
$user_profile = $adapter->getUserProfile();
$user_profile = json_decode(json_encode( $user_profile ));
$_SESSION['social_profile'] = $user_profile;
header("Location: http://find.pk/user/social_got");
exit;
break;
case 'linkedin':
$config = "hybridauth/config.php";
require_once( "hybridauth/Hybrid/Auth.php" );
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "LinkedIn" );
$user_profile = $adapter->getUserProfile();
$user_profile = json_decode(json_encode( $user_profile ));
$_SESSION['social_profile'] = $user_profile;
header("Location: http://find.pk/user/social_got");
exit;
break;
case 'google':
$config = "hybridauth/config.php";
require_once( "hybridauth/Hybrid/Auth.php" );
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "Google" );
$user_profile = $adapter->getUserProfile();
$user_profile = json_decode(json_encode( $user_profile ));
$_SESSION['social_profile'] = $user_profile;
header("Location: http://find.pk/user/social_got");
exit;
break;
case 'live':
$config = "hybridauth/config.php";
require_once( "hybridauth/Hybrid/Auth.php" );
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "Live" );
$user_profile = $adapter->getUserProfile();
$user_profile = json_decode(json_encode( $user_profile ));
$_SESSION['social_profile'] = $user_profile;
header("Location: http://find.pk/user/social_got");
exit;
break;
default:
# code...
break;
}
exit;
}