Sign in with LinkedIn on your PHP website – Tutorial

Sign in with LinkedIn on your PHP  website – Tutorial

Apparently, it’s not easy for beginners to get started with OAuth protocol and tedious authentication/authorization process. In this article, we’re going to simplify LinkedIn Login integration as much as possible. Alright, so here is the basic overview of what we’re going to do

  1. Procedure / How it works
  2. Creating LinkedIn app
  3. Communicating with LinkedIn
  4. Getting user details
  5. Going Live

How it works

  1. Our webpage will send user to LinkedIn site so he/she can authorize permissions.
  2. After that, user will be brought back to your site with success or failure information.
  3. We will then store the required information in our database or use however we want.

Creating LinkedIn App

You are required to have a LinkedIn account in order to create a LinkedIn APP. So once you’re done with that, visit this link and create a new application. After that you’ll have the app key and app secret, which is necessary to integrate LinkedIn login feature on your php website. So, copy that information so we can use it later in this article. Also make sure you add your webpage ( the page which is going to start the communication, suppose linkedin_login.php ) url to list of 

Communicating with LinkedIn

LinkedIn allow us to use both OAuth2.0 and OAuth1.0a, in this article we’re going to use OAuth2. We’ll have two different files to make it simple to understand, linkedin_login.php and linkedin_callback.php. Also we’ll assume the domain name  At user user will visit the, here is the code for that



Now user will leave your site i.e. and visit linkedin for authorization, if everything went good, user will be redirected to here it is:





Going Live

You may have noticed that only your email address is working with linkedin login, not others. The reason behind this is your APP Mode. By default LinkedIn application is under development mode. So, if you want to make the LinkedIn login active for other users, you need to set it to Live by going into Application Dashboard > Settings. I can’t provide the URL as app id will be different for each app. However URL will look something like


That’s it, enjoy your feature!

Feel free to leave comment for question or concerns.

Share this post

Post Comment