Retrieving Linkedin Group Discussion Posts Using ColdFusion

I was requested by a client to pull the latest posts from their LinkedIn group onto one of our website pages.

I have been developing ColdFusion 9 for quite a few days and decided to post my request here in the hope that someone could help me.

I can get to the point where I have requestToken. I understand that now I need to sign a request token in order to get accessToken. My problem is that I need to do this off-screen. However, all the examples that I can find redirect the front-end user to the authorization URL to allow the user to authenticate, but I do not want the user to authenticate, instead I want to authenticate the server side.

I am trying to use the Java Scribe cover library. Below is the code that I still have that receives the requestToken (as well as the authorization URL). I need someone to point me in the right direction in order to sign a token on the server code so that I can make the necessary calls to use the groups API (for example, http://api.linkedin.com/v1/groups/{id}/posts?count=5&start=1)

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

    // I NEED TO DEFINE WHAT TO DO AT THIS POINT TO SIGN THE REQUEST SERVER SIDE
    ...
    ...
</cfscript>
+5
source share
2 answers

Kirsten is technically correct - Linked In Api requires user authentication. This is annoying because you need to authenticate in order to even receive group messages.

However, there are ways around it.

. , , Linked In, , :

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

api, :

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

oAuthService.signRequest(accessToken, req);

, Linked In T & C, .

+3

OAuth , ( LinkedIn). .

API LinkedIn, , LinkedIn, , PIN- ( ) .

, " ", LinkedIn.

+2

All Articles