I was trying to make HybridAuth forget last user login, but nothing worked!! then I noticed very strange session behavior when using HybridAuth:
1- HybridAuth Sessions are not destroyed even when using session_destroy:
session_start();
var_dump($_SESSION); //Session Values before authentication
require_once("hybridauth/Hybrid/Auth.php");
$config = 'hybridauth/config.php';
$hybridauth = new Hybrid_Auth( $config );
$google = $hybridauth->authenticate( "Google" );
session_unset();
session_destroy();
var_dump($_SESSION); //Session values after destroy
The Output:
Session Values before authentication!
array (size=2)
'HA::CONFIG' =>
array (size=3)
< ----- content here ------>
'HA::STORE' =>
array (size=5)
< ----- content here ------>
Session values after destroy
array (size=0)
empty
I get session values even before initializing Hybrid_Auth class. And when I refresh the page same values remain although it appears that the values where cleared at the end of the code.
2- Infinite redirect loop when you clear session at start
session_start();
session_destroy();
require_once( "hybridauth/Hybrid/Auth.php" );
$config = 'hybridauth/config.php';
$hybridauth = new Hybrid_Auth( $config );
$google = $hybridauth->authenticate( "Google" );
When I run the above code I get ERR_TOO_MANY_REDIRECTS error!
What is going on here?