PHP LinkedIn OAuth Login Integration Tutorial From Scratch

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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

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

<title>Simple Step by step PHP API LinkedIn OAuth Login Integration</title>

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;

    <div class="pakainfo container">
        <div class="margin10 pakainfo"></div>
        <div class="col-sm-3 col-sm-offset-4 padding20">

            <div class="error"></a>

        <a class="link login" href="index.php"> <img src="" /> Login with LinkedIn

        <div id="profile-outer">
                    <img src="pictureUrl; ?>"
                        class="user-profiles" />
                <div class="profile-row">
                    <span class="user-avtar">firstName; ?></span>
            <div class="results_done">
                You have 100% success Logged in Good Luck. Click here to <a href="index.php?action=logout"> Logout </a>


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.

Related FAQ

Here are some more FAQ related to this Article:

  1.   how to check empty array in laravel controller?
  2.   Yoast Wordpress Seo Settings
  3.   PHP cURL Http Authorization Pass Header Examples
  4.   Laravel Load multiple views in same controller
  5.   The Features of the Best Ergonomic Keyboard
  6.   Get the Last Inserted Id Using Laravel Eloquent
  7.   ng-mousemove Event using Angular Example
  8.   PHP Creating Unique Title Slugs in Laravel
  9.   laravel 6 Update Data in AJAX CRUD Operations
  10.   ZoomingPDFViewer-zoomin and zoomout on-button click - Custom PDF Rendering