Adapter capabilities

 User authentication YES
 User profile YES
 Update status YES
 Access provider API YES

Adapter specifications

 ID LinkedIn
 Protocol OAuth 2
 IDp URL https://www.linkedin.com
 Keys registration https://www.linkedin.com/developers/apps
 Dev documentation https://www.linkedin.com/developers
 Wrapper ./Hybrid/Providers/LinkedIn.php
Callback URL http://mywebsite.com/path_to_hybridauth/?hauth.done=LinkedIn

Configuration & Usage

  1. <?php
  2. $config = array(
  3. "base_url" => "http://mywebsite.com/path/to/hybridauth",
  4. "providers" => array(
  5. "LinkedIn" => array(
  6. "enabled" => true,
  7. "keys" => array("id" => "PUT_YOURS_HERE", "secret" => "PUT_YOURS_HERE"),
  8. "scope" => array("r_liteprofile", "r_emailaddress", "w_member_social"), // optional
  9. ),
  10. ),
  11. );
  12.  
  13. require_once("/path/to/hybridauth/Hybrid/Auth.php");
  14.  
  15. $hybridauth = new Hybrid_Auth($config);
  16.  
  17. $adapter = $hybridauth->authenticate("LinkedIn");
  18.  
  19. $user_profile = $adapter->getUserProfile();
  20.  
  21. $status = $adapter->setUserStatus("Check out developer.linkedin.com!", $user_profile->identifier);

For LinkedIn you can configure several extra options:

  • scope: An array of permissions you want to request from the user. Possible values: "r_liteprofile", "r_emailaddress", "w_member_social".

Registering application

  1. Go to https://www.linkedin.com/developers/apps and create a new application by clicking "Create Application".
  2. Fill out any required fields such as the application name and description.
  3. Put your website domain in the OAuth 2.0 Authorized Redirect URLs: (i.e http://mywebsite.com/path_to_hybridauth/?hauth.done=LinkedIn)
  4. Once you have registered, copy and past the created application credentials (App ID and Secret) into the HybridAuth config file.