This is what I have, but LinkedIn returns “unauthorized” error back:
var OAuth= require('oauth').OAuth;
oa= new OAuth("https://api.linkedin.com/uas/oauth/requestToken",
"https://api.linkedin.com/uas/oauth/accessToken",
"key", "secret", "1.0A", "http://test.com/oauth/callback", "HMAC-SHA1");
var post_data = {
share: {
"comment":"testing 123",
"visibility": {
"code":"anyone"
}
}
};
oa.post("http://api.linkedin.com/v1/people/~/shares?twitter-post=true", oauth_token, oauth_token_secret, post_data, 'application/json; charset=UTF-8', function(error, data){
}
Appreciate any help. The oauth_token and oauth_token_secret works when fetching resources, so I think they are correct.
Regards,
Johnny
I suggest you to use everyauth which is built on oauth and supports LinkedIn. It takes cares of all the authentication and it is configured easily. After the configuration, the client will be authenticated by a link like
/oauth/linkedinand after authentication you can have the tokens in express routes.