如何发布到LinkedIn“分享"与节点身份验证? [英] How to post to LinkedIn "Share" with node-auth?

查看:190
本文介绍了如何发布到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.

这篇关于如何发布到LinkedIn“分享"与节点身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆