Login With LinkedIn Using PHP
Thursday, Jan 12, 2017
In this tutorial we will show you how to do login with LinkedIn using PHP with simple and easy to integrate code provided by LinkedIn you will need to create an application on linkedin to do login from your website. You may also like login with google using PHP.
To Login With LinkedIn Using PHP It Takes Only Two Steps:-
- Create a LinkedIn Application and get all the details
- Make a PHP file to login with LinkedIn
Step 1.Create a LinkedIn Application and get all the details
Create a new LinkedIn application from here https://www.linkedin.com/secure/developer. Fill all the details and after submit the form get your API key and Secret Key from linkedin.Then edit the config.php file and enter your details like url, callback url, key, secret etc. You may also like login with facebook using PHP.
Step 2.Make a PHP file to login with LinkedIn
We make a PHP file and save it with a name linkedin_login.php
<?php session_start(); include_once 'oAuth/config.php'; include_once 'oAuth/linkedinoAuth.php'; $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['base_url'] . 'linkedin_login_oauth/linkedinauth.php' ); $linkedin->getRequestToken(); $_SESSION['requestToken'] = serialize($linkedin->request_token); header("Location: " . $linkedin->generateAuthorizeUrl()); ?>
In this step we insert all the required files and create a new linkedin objects and then get access token and generateAuthorizeUrl for logging in to linkedin.You may also like login with twitter using PHP.
Thats all, this is how to do login with linkedin using PHP.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.