You can instantiate a Hybrid_Auth
class in your logout
function and then use the logoutAllProviders
method:
(new Hybrid_Auth($config))->logoutAllProviders();
However, I suggest that you pass HybriadAuth's instance to the constructor:
# YOUR CONTROLLER
public function __construct(Hybrid_Auth $hybridAuth)
{
$this->hybridAuth = $hybridAuth;
}
public function logout()
{
$this->HybridAuth->logoutAllProviders();
}
# ELSEWHERE IN THE APP (ROUTES FILE, FOR INSTANCE)
App::bind('Hybrid_Auth', function() {
return new Hybrid_Auth(array(
"base_url" => "http://site.com/login/auth",
"providers" => array (
"OpenID" => array (
"enabled" => true
),
"Steam" => array (
"enabled" => true
)
)
));
});
With dependency injection, your controller should also be testable.