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 :

  1. // hybridauth-2.x.x/hybridauth/config.php
  2. return
  3. array(
  4. // "base_url" the url that point to HybridAuth Endpoint (where index.php and config.php are found)
  5. "base_url" => "http://mywebsite/path/to/hybridauth/",
  6.  
  7. "providers" => array (
  8. // google
  9. "Google" => array ( // 'id' is your google client id
  10. "enabled" => true
  11. "keys" => array ( "id" => "", "secret" => "" ),
  12. ),
  13.  
  14. // facebook
  15. "Facebook" => array ( // 'id' is your facebook application id
  16. "enabled" => true,
  17. "keys" => array ( "id" => "", "secret" => "" ),
  18. "scope" => "email, user_about_me, user_birthday, user_hometown" // optional
  19. ),
  20.  
  21. // twitter
  22. "Twitter" => array ( // 'key' is your twitter application consumer key
  23. "enabled" => true,
  24. "keys" => array ( "key" => "", "secret" => "" )
  25. ),
  26.  
  27. // and so on ...
  28. ),
  29.  
  30. "debug_mode" => false ,
  31.  
  32. // to enable logging, set 'debug_mode' to true, then provide here a path of a writable file
  33. "debug_file" => "",
  34. );

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

  1. $config_file_path = '/full/path/to/hybridauth/config.php';
  2.  
  3. require_once( "/path/to/hybridauth/Hybrid/Auth.php" );
  4.  
  5. $hybridauth = new Hybrid_Auth( $config_file_path );

Or, configurating Hybrid_Auth using an array as parameter:

  1. require_once( "/path/to/hybridauth/Auth.php" );
  2.  
  3. $config = array(
  4. // "base_url" the url that point to HybridAuth Endpoint (where the index.php and config.php are found)
  5. "base_url" => "http://mywebsite.com/path/to/hybridauth/",
  6.  
  7. "providers" => array (
  8. "Twitter" => array (
  9. "enabled" => true, "keys" => array ( "key" => "****", "secret" => "****" )
  10. )
  11. )
  12. );
  13.  
  14. $hybridauth = new Hybrid_Auth( $config );