Authenticate with OpenID IDPs such as Stackoverflow, Yahoo! Japan and Mixi.jp
HybridAuth can support a large variety of OpenID providers. The new version of HybridAuth 2.0 make use of LightOpenID PHP library for easy openid authentication and which supports both OpenID 1.1 and 2.0.
HybridAuth OpenID adapter will require an openid_identifier
(The OpenID identity provider identifier) as extra parameter. To know more please refer to OpenID adapter section.
1. Enable OpenID provider on Hybridauth config:
2. Instantiate Hybrid_Auth class:
- require_once( "/path/to/hybridauth/Hybrid/Auth.php" );
- // Enabel OpenID adapter on Hybrid_Auth config
- $config = array(
- "base_url" => "http://mywebsite.com/path/to/hybridauth/",
- "providers" => array ( "OpenID" => array ( "enabled" => true ) )
- );
3. Authenticate with Stackoverflow:
- $ha = new Hybrid_Auth( $config );
3. Authenticate with Yahoo Japan:
- $adapter = $ha->authenticate( "OpenID", array( "openid_identifier" => "openid.stackexchange.com/"));
- $user_data = $adapter->getUserProfile();
3. Authenticate with Mixi.jp:
- $adapter = $ha->authenticate( "OpenID", array( "openid_identifier" => "https://yahoo.co.jp/"));
- $user_data = $adapter->getUserProfile();
4. Authenticate with Wordpress:
- $adapter = $ha->authenticate( "OpenID", array( "openid_identifier" => "https://mixi.jp" ) );
- $user_data = $adapter->getUserProfile();
- $adapter = $ha->authenticate( "OpenID", array( "openid_identifier" => "<username>.wordpress.com" ) );
- $user_data = $adapter->getUserProfile();