In this post, I will show how you can connect with LinkedIn from your salesforce org using a small piece of code.
So, Get ready to do another integration with Salesforce.
Before we start playing with the code we need to create a Custom Setting where we will store Access Token and Expiry time so that we could use this while making the callouts.
Setup Custom Setting: –
Go to Setup -> Develop -> Custom Settings -> New -> Name it “LinkedIn Token Info“
Create a VF page and Controller Class: –
Create an Apex class Name it “LinkedlnoAuthController“
Go to Setup -> Develop -> Apex Classes -> New ->
Next, Create a VF page that will do the Authorization with LinkedIn. Name it “LinkedlnoAuth“.
After you created VF page Preview it, Copy the URL and paste somewhere into the notepad++ or any other text editor. URL will be something like below
Create an App in LinkedIn: –
Time to create a Connected App into LinkedIn developer account to get the Client Id (Consumer Key) and Client Secret(Consumer Secret).
You LinkedIn app page will look like below
Make Required Changes into Apex Class: –
1 – Open LinkedlnoAuthController class replace redirect_URI with your VF page preview URI (line #10).
2 – Replace consumerKey with your client Id and consumerSecret with your Client Secret (line #8 and #9).
Now, we are all set to let’s do some testing and see if we have successfully integrated LinkedIn with Salesforce.
Open LinkedlnoAuth VF page and preview it. Click Connect with LinkedIn button, it will open a new screen asking your LinkedIn username and password
Enter your username and password then sign in Grant permission to Application -> Click Complete Authorization, a success message will show.
Now Click on Get Basic Info -> A basic information will show here in PAGE
Facing any issue let me know in the comment section.
Happy Coding 🙂 Enjoy Coding 🙂
Sharing is caring 🙂