简体   繁体   中英

How do I add LinkedIn login to Meteor?

I have tried both pauli:accounts-linkedin and jonperl:linkedin packages in combination with accounts-base & accounts-oauth. I tried it with and without accounts-ui. My Facebook login button is working seemlessly. The error I now get is:

Uncaught TypeError: Meteor.loginWithLinkedin is not a function

Once this works, I would also like to customize the permissions granted. If you have any hints on what could be wrong/what I could have forgotten, that'd be great. Otherwise, if you are aware of any example projects or docs, that would be nice, because I could not find any!

That's the problem with third party login without the Mdg support, you cannot know which one will work, test more packages an can asure you that one will work

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

So the way I made it eventually work is with the pauli:accounts-linkedin package. Accounts-UI package doesn't work, so just build your own login button:

in html:

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

in 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);
        }
    });
  }
});

the permissions are to be found on the developer page of linkedin. Last step now is to add the following document to the meteor_accounts_loginServiceConfiguration collection:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM