如何将 LinkedIn 登录名添加到 Meteor?

How do I add LinkedIn login to Meteor?

我已经尝试将 pauli:accounts-linkedin 和 jonperl:linkedin 包与 accounts-base 和 accounts-oauth 结合使用。我在有和没有账户的情况下都试过了-ui。我的 Facebook 登录按钮无法正常工作。我现在得到的错误是:

Uncaught TypeError: Meteor.loginWithLinkedin is not a function

一旦成功,我还想自定义授予的权限。如果您对 wrong/what 我可能忘记的内容有任何提示,那就太好了。否则,如果您知道任何示例项目或文档,那就太好了,因为我找不到任何!

这就是没有 Mdg 支持的第三方登录的问题,你无法知道哪一个可以工作,测试更多的包,可以向你保证一个可以工作

https://atmospherejs.com/?q=linkedin

所以我最终使用的方法是 pauli:accounts-linkedin package. Accounts-UI 包不起作用,所以只需构建您自己的登录按钮:

在html中:

<button id="loginBtn">Login with LinkedIn</button>

在javascript中:

Template.loginTemplate.events({
  'click #loginBtn':function(){
    Meteor.loginWithLinkedIn({
      requestPermissions: ['r_basicprofile','r_emailaddress']
      }, function(err){
        if(err){
          console.log('error with login is: ', err);
        }
    });
  }
});

权限可以在 linkedin 的 developer page 上找到。现在的最后一步是将以下文档添加到 meteor_accounts_loginServiceConfiguration 集合中:

{ 
    "_id" : "J2LPm7ocGfzuiK9J2", 
    "service" : "linkedin", 
    "clientId" : [clientID from linkedin developer page], 
    "secret" : [secret from linkedin developer page]
}