Use ColdFusion to search for LinkedIn Group discussion

I was asked by a client to extract the latest posts in their LinkedIn group to one of our website pages.

I am using ColdFusion 9 for development, And have researched these few days, and decided to post my query here, I hope someone can help me.

I can reach the point where I have a requestToken. My understanding is that I need to sign now Request the token to get the accessToken. My problem is that I need to do this behind the scenes. However, all the examples I can find are to redirect the front-end user to the authorization URL to allow the user to authenticate, but I don’t want the user For authentication, I want to authenticate on the server side.

I am trying to use the Scribe Java wrapper library. Below is the code I have so far obtained the requestToken (and the authorization URL). I need someone Point me in the right direction to sign the token on the server-side code so that I can make the necessary calls to use the Groups API (e.g. http://api.linkedin.com/v1/groups/{ID}/post count= 5& start = 1)


var l = {};
//The LinkedIn public and private keys for application
l.oauth_consumer_key = "[My public key]";
l.oauth_sign_key = "[My secret key]";
l.serviceBuilder = CreateObject("java","org.scribe.builder .ServiceBuilder");
l.LinkedInApiClass = CreateObject("java", "org.scribe.builder.api.LinkedInApi").getClass();
l.service = l.serviceBuilder.provider( l.LinkedInApiClass).apiKey(l.oauth_consumer_key).apiSecret(l.oauth_sign_key).callbac k("[My callback url]").build();
l.requestToken = l.service.getRequestToken();
l.authUrl = l.service.getAuthorizationUrl(l.requestToken);

// I NEED TO DEFINE WHAT TO DO AT THIS POINT TO SIGN THE REQUEST SERVER SIDE
...
...
pre>
Kirsten is technically correct – linking in Api requires user authentication. This is annoying because You need to authenticate or even retrieve group posts.

However, there are some ways around it.

Using scribe, you can manually create an access token. Then I will do What is to create a virtual user account on LinkedIn, verify the user normally and save the returned signature credentials in your database, and then you can use it to create a token:

var accessToken = createObject("java", "org.scribe.model.Token").init(
"singedTokenStringReturnBackFromLinkedIn",
"singedSecretStringReturnBackFromLinkedIn",
"oauth_token=singedTokenStringReturnBackFromLinkedIn&oauth_token= singedSecretStringReturnBackFromLinkedIn&oauth_expires_in=0&oauth_authorization_expires_in=0"
);

Then you can skip the authentication part and call the api, Allows you to display group posts without the current user logging in:

var req = createObject("java", "org.scribe.model.OAuthRequest").init(< br /> createObject("java", "org.scribe.model.Verb").GET,
"http://api.linkedin.com/v1/groups/123456/posts"
) ;

oAuthService.signRequest(accessToken, req);

I don’t know if this will violate Linked In’s T& C.

I was asked by a client to extract the latest post from their LinkedIn group to one of our website pages.

I am using ColdFusion 9 for development and have been researching for these few days And decided to post my query here, hoping someone can help me.

I can reach the point where I have a requestToken. My understanding is that I now need to sign the request token to get the accessToken. I The problem is that I need to do this behind the scenes. However, all the examples I can find are to redirect the front-end user to the authorized URL to allow the user to authenticate, but I don’t want the user to authenticate, I want to Server side for authentication.

I am trying to use the Scribe Java wrapper library. Below is the code I have so far obtained the requestToken (and the authorization URL). I need someone to point me in the right direction to sign The token on the server-side code so that I can make the necessary calls to use the Groups API (e.g. http://api.linkedin.com/v1/groups/{ID}/post count=5&start=1)< /p>


var l = {};
//The LinkedIn public and private keys for application
l.oauth_consumer_key = "[ My public key]";
l.oauth_sign_key = "[ My secret key]";
l.serviceBuilder = CreateObject("java","org.scribe.builder.ServiceBuilder");
l.LinkedInApiClass = CreateObject("java", "org.scribe. builder.api.LinkedInApi").getClass();
l.service = l.serviceBuilder.provider(l.LinkedInApiClass).apiKey(l.oauth_consumer_key).apiSecret(l.oauth_sign_key).callback("[My callback url]").build();
l.requestToken = l.service.getRequestToken();
l.authUrl = l.service.getAuthorizationUrl(l.requestToken);
< br /> // I NEED TO DEFINE WHAT TO DO AT THIS POINT TO SIGN THE REQUEST SERVER SIDE
...
...

Kirsten is technically correct-linking in Api requires user authentication. This is annoying because you need to authenticate or even retrieve group posts.

However, there are some ways to revolve around it.

Using scribe, you can manually create an access token. Then what I have to do is create a virtual user account on LinkedIn, verify the user normally and Save the returned signing credentials in your database, and then you can use it to create a token:

var accessToken = createObject("java", "org.scribe. model.Token").init(
"singedTokenStringReturnBackFromLinkedIn",
"s ingedSecretStringReturnBackFromLinkedIn",
"oauth_token=singedTokenStringReturnBackFromLinkedIn&oauth_token_secret=singedSecretStringReturnBackFromLinkedIn&oauth_expires_in=0&oauth_authorization_expires_in=0"
api allows you to display the group, and you can call the api verification part, and then you can call it Without the current user login:

var req = createObject("java", "org.scribe.model.OAuthRequest").init(
createObject(" java", "org.scribe.model.Verb").GET,
"http://api.linkedin.com/v1/groups/123456/posts"
);
< br />oAuthService.signRequest(accessToken, req);

I don’t know if this will violate Linked In’s T& C.

Leave a Comment

Your email address will not be published.