How to Login With LinkedIn Using PHP

Linkedin is one of the most popular social networks with the huge user base. If you want to allow your website’s user to login with the social account, LinkedIn login needs to be added. LinkedIn provides various API to integrate user login system in the website. Using LinkedIn API you can let the user login to your website with their LinkedIn account. You may also like How to Login with Google Account in CodeIgniter.

PHP Code

<?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());
?>

Leave a Reply

Your email address will not be published. Required fields are marked *