Posted inTechnology / php / Programming

PHP LinkedIn OAuth Login Integration Tutorial From Scratch

Today, We want to share with you Login with LinkedIn OAuth using PHP.
In this post we will show you developers linkedin for linkedin api key, hear for Login with LinkedIn using PHP and LinkedIn oAuth API we will give you demo and example for implement.
In this post, we will learn about Simple PHP LinkedIn OAuth Login Integration with an example.

Login with LinkedIn OAuth using PHP

There are the Following The simple About PHP LinkedIn OAuth Login Integration using PHP Full Information With Example and source code.and more Example Like developers linkedin,linkedin api key,linkedin ads api,linkedin api,linkedin api limits,linkedin api search by email.

Step 1 : Create LinkedIn Devloper Accounts

First of all You Creating and setting LinkedIn application and then You Requesting get a authorization source code, After that You recived Obtaining access token and last step Into making an authenticated LinkedIn request to fetch some resources

First of all I am gonna to create a new developer application Accounts in the LinkedIn developer console. here simple fill up your All Information and get To LinkedIn Authentication some Keys Like Client ID and Client Secret


Login with LinkedIn using PHP

Simple PHP LinkedIn OAuth Login Integration

There are the Following Created PHP file and Folder Structures.

  1. ->index.php
  2. ->config.php
  3. ->linkedin-icon.png
  4. oauth-Folder Name
  5. oauth->http
  6. oauth->oauth_linkedin_user



debug = false;
    $linkedin_user->debug_http = true;
    $linkedin_user->redirect_uri = REDIRECT_URI;
    $linkedin_user->server = "LinkedIn";
    $linkedin_user->linkedin_user_id = CLIENT_ID;
    $linkedin_user->linkedin_user_secret = CLIENT_SECRET;
    $linkedin_user->scope = SCOPE;
    if (($results_done = $linkedin_user->Initialize())) {
        if (($results_done = $linkedin_user->Process())) {
            if (strlen($linkedin_user->authorization_error)) {
                $linkedin_user->error = $linkedin_user->authorization_error;
                $results_done = false;
            } elseif (strlen($linkedin_user->access_token)) {
                $results_done = $linkedin_user->CallAPI(',email-address,first-name,last-name,picture-url,public-profile-url,formatted-name)', 'GET', array(
                    'format' => 'json'
                ), array(
                    'FailOnAccessError' => true
                ), $user);
        $results_done = $linkedin_user->Finalize($results_done);
        $_SESSION["user_id_live"] = $user->id;
    if ($linkedin_user->exit) {
    if ($results_done) {
        // Do your code with the Linkedin Data
    } else {
        $error = $linkedin_user->error;
} else {
    $_SESSION = array();

Simple Step by step PHP API LinkedIn OAuth Login Integration

body {
    width: 550px;
    font-family: Arial;

#profile-outer {
    background: #79ccc4;
    padding: 40px;
    color: #505050;
    text-align: center;

.user-avtar {
    font-weight: bold;

.user-profiles {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 20px;

.results_done {
    padding: 20px;
    background: #5b948f;
    border: #51847f 1px solid;
    color: #c4e0de;

.error {
    background: #ffc6d1;
    border: #efbac4 1px solid;
    color: #b34f59;
    padding: 20px;

.link {
    background: #41b2f1;
    color: #FFF;
    display: inline-block;
    margin-top: 20px;
    padding: 20px 20px 20px 20px;
    text-decoration: none;

.link img {
    vertical-align: middle;

<img src="pictureUrl; ?>" class="user-profiles" />
firstName; ?>
You have 100% success Logged in Good Luck. Click here to Logout

PHP Login with LinkedIn OAuth Output

Lastly You results_doneful LinkedIn step by step OAuth PHP authentication via this API, the social media LinkedIn get your profile pictures and some data such as Your name and the profile will be show with the your main session exp/Logout button option as such as below screen shote.

PHP Login with LinkedIn Download Source code

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Login With LinkedIn Using API In PHP.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

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

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype