how to sign in users in my website using linkedIn api ?

61 posts / 0 new
Last post
Skander Mabrouk's picture
Joined: 2010-12-10
Dec 13, 2010
how to sign in users in my website using linkedIn api ?

Hi,i have passed a lot of time trying to sign in users in my website using linkedIn but i did not succeed.What i want is to display a linkedIn Button, the user sign in linkedIn using that button. Every thing is ok but my script should know that user is correctly signed In.in my website, i use e-mail to login users, so are they any way to get the user e-mail from Javascript library to post it to my server to be able to identify the user in my website and sign it automatically ?i have read a lot of articles and docs but usually, i did not get the response of this issue: How can i sign in users in my website after the signed in LinkedIn ?thanx

Skander Mabrouk's picture
Joined: 2010-12-10
Dec 13, 2010

After 2 hours of googling, i got this tutorial: http://developer.linkedin.com/node/1225.i know now that i can use the linkedin-id to send it to our server. But how can can i iddentify that this id is for user X registred in my website ?should i make a call for the registred application that i have created ? please i need an answer !thanx

Pablo Fernandez's picture
LinkedIn Employee
Joined: 2009-11-23
Dec 13, 2010

Hello Skander,There is no built-in to do what you want.You might, once the user is authenticated with LinkedIn, take the member_id ('id' alphanumeric field) and store it somewhere on your DB along with your own user_id to create a relation.This field ('id') is the only field that the terms of use allow to store indefinitely and it's guaranteed not to change, so you should be fine this way.Cheers!

Skander Mabrouk's picture
Joined: 2010-12-10
Dec 13, 2010

thank you Pablo for your quick response.

Skander Mabrouk's picture
Joined: 2010-12-10
Dec 14, 2010

Hi Pablo,everything runs perfect with your suggestion. But there is some problem: After sending the (id) to my server, i want to collect some user information like name, last name ...How can use that (id ) to get this information from my server (php) and not using the javascript in object ? should i use the oauth library to make requests to linkedin server ? if yes, please can you give me an idea to do that.

Joined: 2010-12-13
Dec 13, 2010

Hi guys,is there's an easy way to do this?i have tried to integrate login with linkedin button on a wordpress site. but got no luck in doing it.I have tried this link http://developer.linkedin.com/node/1225 but no luck. what programming skills needed. is there any template or demo site for this. thanks

Skander Mabrouk's picture
Joined: 2010-12-10
Dec 14, 2010

you should use firebug console to see what error was occured. And i suppose that you have a problem with the javascript url when you created your application. If this is the error, you should use your local domain name in the javascript url.for example, i use http://local.mywebsite/ as local domain name during the developpement, so i putted local.mywebsite in the javascript url int application config. After you can change that to your production domain name.

Skander Mabrouk's picture
Joined: 2010-12-10
Dec 14, 2010

after a lot of searching on the web, i created a new symfony plugin called sfLinkedInPluginthis plugin makes the integration of the oauth library very easy with symfony projects. Also, it integrates the linkedin javascript framework.if you have any question, you can ask me.

Yonatan Weic  ✔'s picture
Joined: 2010-09-25
Jan 19, 2011

I saw your plugin, my question is, have you managed to find a way to collect the user's details as you wanted without violating the API agreement ? (such as name,company...  )

Facundo Villaveiran's picture
Joined: 2011-03-01
Mar 1, 2011

Hi Skander,I'd like to know if you managed to obtain other info from the user such as the name. I'm doing initial research in order to integrate LinkedIn login for a WordPress site (I'd like the user to be able to sign up as a contributor).Your response is much appreciated.Regards,

Kirsten Hunter's picture
Joined: 2011-06-30
Mar 1, 2011

Have you checked on the new JSAPI?  It greatly simplifies authentication and should work for you.  Otherwise, you should read over the basic tutorial on oauth which will show you how to get the user's profile information.

Juan Sanchez Bonet's picture
Joined: 2011-06-28
Jun 28, 2011

Hi guys,Have you tried this but validating the access depending on if the user is a member of a group? I mean, I include the button "sign in with Linkedin" but the user will have access to this page only if he is actually on a particular group / subgroup.Thanks in advance

Sumit Adak's picture
Joined: 2011-07-22
Sep 2, 2011

I have a website and it requires that I use my linkedin username and password to sign in as well along with the my website's username and password. It is possible though I am unable to use the correct method. Can anyone please provide me a code or any script or any kind of procedure by which I can meet my requirement.

Kirsten Hunter's picture
Joined: 2011-06-30
- (Reply to #13) Sep 2, 2011

Please read the documentation. There are many ways to do this, both with the javascript API and with our plugins, such as the Sign in With LinkedIn Plugin/

Edward Marno's picture
Joined: 2012-03-21
Apr 25, 2012

Hi Facundo, did you get anywhere with this? Am faced with a similar problem! thanks

Yann Hourdel's picture
Joined: 2011-09-07
May 2, 2012

Hi Edward, hi all

I think the trick everyone here is looking for is explained at https://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens
I implemented it on a Ruby on Rails app, and PHP uses the same technique so don't hesitate to ask me questions if you don't manage to make it work.

Yann

John Furrier's picture
Joined: 2012-05-04
Jul 10, 2012

I am looking to have users login on my site with their LinkedIn credentials... is the api workable? I'd love to get your feedback

Yann Hourdel's picture
Joined: 2011-09-07
Jul 11, 2012

Hi John,

Quick answer is yes.
You have to choose between 3 possibilities: JS authentication, REST authentication and both of them. Everything depends on where you need to use API functions or API data.
Give us more details if you want more help ;-)
Have a nice day

Yann

Don Gooding's picture
Joined: 2012-10-04
Oct 4, 2012

I'm trying to see if the LinkedIn login can work on the free (or upgraded) cloud version of Wordpress vs. on our own web site. It looks like all the comments on this thread are relevant to the latter... and I'm not a programmer. Thanks.

Yann Hourdel's picture
Joined: 2011-09-07
Oct 4, 2012

Hi Don,

I have no idea, but the generic answer is "the JS way will always work". But if you're not a "programmer", maybe you should think about using LinkedIn plugins instead of their API. They are less powerful, but much easier to use.

Yann

Brayden Cleary's picture
Joined: 2012-10-27
Oct 27, 2012

Yann,

I'm trying to use the LinkedIn api to pull a profile picture to the rails app I'm building. My ideal scenerio would be to have a 'sign in with linkedin' button so that the picture can be pulled automatically. I've only been programming for a month so I'd really appreciate some help/code samples.

Thanks,

Brayden

Yann Hourdel's picture
Joined: 2011-09-07
Oct 27, 2012

Hi Brayden,

How is your form generated precisely ? Are you using "form_for" helpers or stuff like that ?
Also, you need to precise what you want to happen exactly. Just imagine that everything is possible and tell us what exact scenario you imagine for this to happen. Something like "the User clicks on this button, the LinkedIn authorize window appears, he clicks 'ok', his picture appears on the form" or similar ?

Yann

Brayden Cleary's picture
Joined: 2012-10-27
Oct 27, 2012

Yann,

Thanks for the quick reply! I know how to use a form_for helper so that's what I'll be using in the app. I want someone to be able to click a button that allows them to add their linkedin picture to a form by signing into linkedin. You essentially described exactly what I want to happen. Again, I'm super new to ruby/rails so I really appreciate your help!

Brayden

Yann Hourdel's picture
Joined: 2011-09-07
Oct 27, 2012

Ok, that's a start. What do you want to store on your application, exactly ? You have the following options:
- storing only the picture URL into your database (the solution I strongly recommend)
- downloading the picture to your server and storing the path to the picture in your database
- uploading the picture to a CDN like amazon S3 and store the URL to the result in your database

Brayden Cleary's picture
Joined: 2012-10-27
Oct 27, 2012

Only looking to store the url in my database...

Yann Hourdel's picture
Joined: 2011-09-07
Oct 28, 2012

Ok so the easiest way, I think, would be to take example from https://developer.linkedin.com/documents/creating-member-profile-plugin

1. You get an API key
2. You write a javascript function which, when called, extracts the User picture URL and fills your form
3. You include the LinkedIn lib files and ask for your function to be triggered when the User authenticates

Take a look at this example I just gisted: https://gist.github.com/3968089
It does exactly what I described, filling up the form once the User has authenticated. Feel free to use this example, but please change the api_key to be yours and not mine.
Also, the first "script" tag is an include of jQuery so you might want to remove it if your app already includes it.

Yann

Brayden Cleary's picture
Joined: 2012-10-27
Oct 29, 2012

Got It working! Many many thanks, Yann.

You're the man,

Brayden

Yann Hourdel's picture
Joined: 2011-09-07
Oct 29, 2012

You're welcome ;)

Yann

Joined: 2012-11-05
Nov 6, 2012

Hi! Yann Hourdel! I am new to Ruby on Rails. I would like to add LinkedIn Authentication to my Rails App and I should be able to Post to LinkedIn through my Rails app. I went thru linkedin api also,but i dont know how to implement it.

Yann Hourdel's picture
Joined: 2011-09-07
Nov 6, 2012

Hi Nishank,

Will you only make LinkedIn calls from your server ? Or also from the User browser ?
It's important to know that because the authentication system is not the same.
Kind regards,

Yann

Joined: 2012-11-05
Nov 6, 2012

Hi ! Yann ! Thanks so much for immediate reply. Actually i achieved signing up from my rails app for linkedin.

But i m trying to post through my rails app to linkedin. Could you please provide me some steps & guide me how to go for it.

Thanks a lot

Yann Hourdel's picture
Joined: 2011-09-07
Nov 6, 2012

So I guess you are using the REST API ? Which gem are you using exactly ?

Joined: 2012-11-05
Nov 6, 2012

Hi ! I am using Linkedin Gem, I want to post on linkedin through rails app. So how to go for it ? What is the way ?

Joined: 2012-11-05
Nov 6, 2012

#<LinkedIn::Mash first_name="Nishank" last_name="Goswami">

This is the output which i get from this code

@profile = client.profile(:fields => ['first_name','last_name']) --- in controller

<%= @profile %> --- in views

I want to fetch only first_name & last_name & display it like this

Welcome ! Nishank Goswami

how to go for this ?

Joined: 2012-11-05
Nov 6, 2012

And for posting what to do ? I found we need network_update_key to post in linkedin through Ruby on Rails app. I somehow managed to find the network_update_key. Can you plz guide on how to go for it for posting in linkedin ? I am using Linkedin Gem in my rails app. Thankyou

Joined: 2012-11-05
Nov 6, 2012

Hi ! I just figured out that,

in controller,

@profile = client.profile(:fields => [:first_name]).first_name
@profiles = client.profile(:fields => [:last_name]).last_name

in views,

<%= @profile %>
<%= @profiles %>

This renders,

Nishank Goswami

Successfully !!!

Now i want to post in linkedin using my ruby on rails app... please help me achieving this. Thanks

Joined: 2012-11-05
Nov 7, 2012

Hi ! Yann Hourdel !

http://stackoverflow.com/questions/13265850/how-to-post-on-linkedin-from-rails-app

please check this out.

Joined: 2012-11-05
Nov 7, 2012

I will be making Linkedin calls from my server only not from user browser.

Yann Hourdel's picture
Joined: 2011-09-07
Nov 7, 2012

Hi Nishank,

First of all, once you got a Mash Object from
@profile = client.profile(:fields => ['first_name','last_name'])
you can reach the different values using '.first_name' and '.last_name' as follows:
Hello, <%= @profile.first_name %> <%= @profile.last_name %> !

Then, what do you want to post on LinkedIn exactly ? Profile updates ? Tweets ? Articles ?

Yann

Yann Hourdel's picture
Joined: 2011-09-07
Nov 7, 2012

For example, if you want to update the User status, you can do it like follows:
client.update_status('This is my new status')

Joined: 2012-11-05
Nov 7, 2012

Hi I m trying to post share. Add share using

client.add_share(:comment => "Testing, 1, 2, 3")

It throws me an error of 403 permission denied. What to do ?

Joined: 2012-11-05
Nov 7, 2012

Also when i tried

client.update_status('This is my new status')

I got this error,

undefined method `update_status' for #<LinkedIn::Client:0xb299084c>

Joined: 2012-11-05
Nov 7, 2012

I m successfully able to execute these queries, & get the desired output.

@profile = client.profile(:fields => [:first_name]).first_name
@profiles = client.profile(:fields => [:last_name]).last_name
@headline = client.profile(:fields => [:headline]).headline

But for,

client.update_status('This is my new status')
client.add_share(:comment => "Testing, 1, 2, 3")

I get errors.

Yann Hourdel's picture
Joined: 2011-09-07
Nov 7, 2012

Oh I think update_status is no longer the right way to do it, sorry.
add_share might be the way, if you make it work. Give me 2mins

Yann Hourdel's picture
Joined: 2011-09-07
Nov 7, 2012

Ok the add_share must be used like follows:
client.add_share({
:comment => "Check out the LinkedIn Share API!",
:content => {
:title => "LinkedIn Developers Documentation On Using the Share API",
:description => "Leverage the Share API to maximize engagement on user-generated content on LinkedIn",
:submitted_url => "https://developer.linkedin.com/documents/share-api",
:submitted_image_url => "http://m3.licdn.com/media/p/3/000/124/1a6/089a29a.png"
}
})

Yann Hourdel's picture
Joined: 2011-09-07
Nov 7, 2012

Or, because I'm not sure with the '-' and '_':

client.add_share({
:comment => "Check out the LinkedIn Share API!",
:content => {
:title => "LinkedIn Developers Documentation On Using the Share API",
:description => "Leverage the Share API to maximize engagement on user-generated content on LinkedIn",
'submitted-url' => "https://developer.linkedin.com/documents/share-api",
'submitted-image-url' => "http://m3.licdn.com/media/p/3/000/124/1a6/089a29a.png"
}
})

Joined: 2012-11-05
Nov 8, 2012

@ Yann, oh ! it worked out ! Thanx so much... for the help ! :-)

Joined: 2012-11-05
Nov 8, 2012

client.add_share(:comment => "Testing, 1, 2, 3")

this also works fine.... i checked my linkedin profile it got posted there successfully
http://www.linkedin.com/profile/view?id=130414714

Yann Hourdel's picture
Joined: 2011-09-07
Nov 8, 2012

You're welcome ;)
Have a nice day

Yann

Joined: 2013-01-08
Mar 6, 2013

I am looking at securing a REST WCF by allowing users to login with their LinkedIn credentials. Just want the user authorized/authenticated by LinkedIn to access the resources from a custom REST WCF. I have used the LinkedIn API to obtain the access token after exchanging the request token. Once I have this, is there a way I can check for the validity of the access token after I store in a session, so that I can use it for subsequent api calls. If yes, how do I check the validity?

Any help is appreciated. Thanks.

Ashish Tomar's picture
Joined: 2012-06-30
Apr 9, 2013

Hello,

I want that a user can register on my sit with linkedIn API, I have tried to do it but i am unable to get users's email id, although i am getting (firstName,lastName,headline and pictureUrl) from linkedIn but i need User email and some other information related to his resume.

Please check the issue : http://bhinfosolutions.com/demos/certifime/linkedin/index.php

I am using this code :

function onLinkedInLoad() {
IN.Event.on(IN, "auth", onLinkedInAuth);
}

// 2. Runs when the viewer has authenticated
function onLinkedInAuth() {
IN.API.Profile("me").result(displayProfiles);
}

// 3. Runs when the Profile() API call returns successfully
function displayProfiles(profiles) {
member = profiles.values[0];
document.getElementById('demo').style.display = 'block';
var profile = "<p class='name' id=\"" + member.id + "\">" + member.firstName + " " + member.lastName + "</p>";
profile += '<p class="headline">'+member.headline+'</p>';
//profile += '<p class="headline">'+member.email-address+'</p>';
document.getElementById("profiles").innerHTML = profile;
document.getElementById("picture").innerHTML = '<img src="'+member.pictureUrl+'" class="image" />';
}

Please help me i am no idea how can i do it.

Pages