如何发布到LinkedIn“分享"与节点身份验证?

如何发布到LinkedIn“分享

问题描述:

这就是我所拥有的,但是LinkedIn返回了未经授权"的错误:

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){
 }

感谢任何帮助.当获取资源时,oauth_token和oauth_token_secret可以工作,所以我认为它们是正确的.

Appreciate any help. The oauth_token and oauth_token_secret works when fetching resources, so I think they are correct.

此致

Johnny

我建议您使用 everyauth 它基于oauth构建,并支持LinkedIn.它负责所有身份验证,并且易于配置.配置完成后,客户端将通过/oauth/linkedin之类的链接进行身份验证,并且在身份验证之后,您可以将令牌包含在快速路由中.

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/linkedin and after authentication you can have the tokens in express routes.