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
- <?php
- $config = array(
- "base_url" => "http://mywebsite.com/path/to/hybridauth",
- "providers" => array(
- "LinkedIn" => array(
- "enabled" => true,
- "keys" => array("id" => "PUT_YOURS_HERE", "secret" => "PUT_YOURS_HERE"),
- "scope" => array("r_liteprofile", "r_emailaddress", "w_member_social"), // optional
- ),
- ),
- );
-
- require_once("/path/to/hybridauth/Hybrid/Auth.php");
-
- $hybridauth = new Hybrid_Auth($config);
-
- $adapter = $hybridauth->authenticate("LinkedIn");
-
- $user_profile = $adapter->getUserProfile();
-
- $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
-
Go to https://www.linkedin.com/developers/apps and create
a new application by clicking "Create Application".
-
Fill out any required fields such as the application name and description.
-
Put your website domain in the OAuth 2.0 Authorized Redirect URLs: (i.e
http://mywebsite.com/path_to_hybridauth/?hauth.done=LinkedIn
)
-
Once you have registered, copy and past the created application credentials (App ID and Secret) into the
HybridAuth config file.