phphybridauthhybridauthprovider

How to get Auth Provider in hybridauth?


i am using hybridauth to allow my users to sign in to my web site. i want to know which auth provider (facebook, googel,..) is current user is using. in this case i am using below script. but it did not get the auth provider. how to do this. give me some hints?

<?php

session_start();

$config = dirname(__FILE__) . '/hybridauth/config.php';
require_once('hybridauth/Hybrid/Auth.php');

$ha = new Hybrid_Auth($config);

$t = $ha->authenticate('Facebook');

if ($t->isUserConnected()) {

    $profile = $t->getUserProfile();
?>

<html>
<body>
<pre><?php echo print_r ($profile); }?></pre>
</body>
</html> 

Solution

  • Have you tried Hybrid_Auth::getConnectedProviders()?

    You could also pass-in a particular provider to check to see if a specific one is connected: Hybrid_Auth::isConnectedWith(provider)

    Check the API doc for more info.