Except for OpenID providers, each social network will require that you create an external application linking your Web site to theirs apis. These external applications ensures that users are logging into the proper Web site and allows IDps to send the user back to the correct Web site after successfully authenticating their Accounts.

You can found where and how to create these externals applications by refering to Registering application and Adapter specifications sections on the list of Identity Providers on the user guide.


HybridAuth will require either a valid config array or a configuration file in order to work. An example of a valid hybridauth configuration file can be found on hybridauth/config.php.

Required configuration informations are:

  • base_url the url to HybridAuth Endpoint (where the index.php and config.php are found)
  • providers the list of providers supported by HybridAuth which you want to use.
    • enabled can be true or false; if you dont want to use a specific provider then set it to 'false'
    • keys are your application credentials, for example :
      • id is your (facebook or live) application id
      • key is your (twitter, linkedin, etc.) application consumer key
      • secret is your application consumer secret
    • scope Optional used for facebook in case you want to provider the permissions requested by default
  • Optional To enable Logging, set debug_mode to true, then provide a path of a writable file on debug_file

Example of using a configuration file :

// hybridauth-2.x.x/hybridauth/config.php
return
   array(
      // "base_url" the url that point to HybridAuth Endpoint (where index.php and config.php are found)
      "base_url" => "http://mywebsite/path/to/hybridauth/",

      "providers" => array (
         // google
            "Google" => array ( // 'id' is your google client id
               "enabled" => true
               "keys" => array ( "id" => "", "secret" => "" ),
            ),

         // facebook
            "Facebook" => array ( // 'id' is your facebook application id
               "enabled" => true,
               "keys" => array ( "id" => "", "secret" => "" ),
               "scope" => "email, user_about_me, user_birthday, user_hometown" // optional
            ),

         // twitter
            "Twitter" => array ( // 'key' is your twitter application consumer key
               "enabled" => true,
               "keys" => array ( "key" => "", "secret" => "" )
            ),

         // and so on ...
      ),

      "debug_mode" => false ,

      // to enable logging, set 'debug_mode' to true, then provide here a path of a writable file
      "debug_file" => "",
    );

Then inside your scripts you shoud call Hybrid_Auth constructor with the full path of it:

$config_file_path = '/full/path/to/hybridauth/config.php';

require_once( "/path/to/hybridauth/Hybrid/Auth.php" );

$hybridauth = new Hybrid_Auth( $config_file_path );

Or, configurating Hybrid_Auth using an array as parameter:

require_once( "/path/to/hybridauth/Auth.php" );

$config = array(
   // "base_url" the url that point to HybridAuth Endpoint (where the index.php and config.php are found)
   "base_url" => "http://mywebsite.com/path/to/hybridauth/",

   "providers" => array (
       "Twitter" => array (
           "enabled" => true, "keys" => array ( "key" => "****", "secret" => "****" )
       )
   )
);

$hybridauth = new Hybrid_Auth( $config );