Hello,
I never looked into the Hybridauth more than to be able to use it as an single-sign-on utility, so the code below is extracted from open-login plugin (see qa-open-login.php).
I haven't tested it but theoretically it should work, with minor code adjustments.
require_once 'Hybrid/Auth.php';
$provider = 'Facebook';
$loginCallback = qa_path('', array(), qa_opt('site_url'));
// prepare the configuration of HybridAuth
$config = getConfig($provider, $loginCallback);
try {
// try to login
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( $provider );
// if ok, update the user status
$adapter->setUserStatus( ... );
} catch(Exception $e) {
// handle this
}
function getConfig($provider, $url) {
$key = strtolower($provider);
return array(
'base_url' => $url,
'providers' => array (
$provider => array (
'enabled' => true,
'keys' => array(
'id' => qa_opt("{$key}_app_id"),
'key' => qa_opt("{$key}_app_id"),
'secret' => qa_opt("{$key}_app_secret")
),
'scope' => $provider == 'Facebook' ? 'email,user_about_me,user_location,user_website' : null, // might need to add more scopes here
)
),
'debug_mode' => false,
'debug_file' => ''
);
}
This piece of code should be put in a separate page. I hope this helps.
Alex