GithubHelp home page GithubHelp logo

pobuchi / meteor-accounts-linkedin Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 20.0 32 KB

A meteor package for LinkedIn's login service.

Home Page: https://atmospherejs.com/pauli/accounts-linkedin

License: MIT License

JavaScript 100.00%

meteor-accounts-linkedin's People

Contributors

brettle avatar fafournier avatar matasjonys avatar matteodem avatar pobuchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meteor-accounts-linkedin's Issues

LinkedIn on Mobile Safari does not work.

Steps to reproduce.

  1. Load up Safari on iOS simulator.
  2. Try to login with LinkedIn by clicking a button. A popup will appear. Enter LinkedIn credentials.
  3. After clicking Login, you are sent to the /?oauth path and you'll see a white window with text along the lines of "This link will close or click here to close it..." The window never closes. If you try to manually close it you can. Going back to the original window will show the default login screen. You won't be able to login. Callback is never fired.

I've tried changing the loginStyle to redirect but I don't think LinkedIn recognizes that function.

The passed in client_id is invalid "undefined"

I am getting this error message... just installed the package and added the service configuration to the configuration json file.

ERROR:
The passed in client_id is invalid "undefined"

Configuration file (accounts segment):
"accounts": {
"linkedin":{
"service" : "linkedin",
"clientId" : "xxxxxxx",
"secret" : "WkYRjtI8rXc8rglu",
"loginStyle" : "popup"
}
}

profile picture is not updating

If you change your profile picture in LinkedIn, the pictureUrl field from the Users collection is not being updated. I get this error in the browser console when I try to display the pictureUrl field:
Failed to load resource: the server responded with a status of 404 (Not Found)
How to replicate:
Change your picture in LinkedIn and try to browse to the URL from pictureUrl field (https://media.licdn.com/xxx...)

Destructuring options parameter in linkedin-client when it's null or undefined

const {
    requestPermissions,
    ...otherOptionsToPassThrough
  } = options

This code breaks with
Uncaught TypeError: Cannot destructure property 'requestPermissions' of 'options' as it is null.
when no options were passed in Meteor.loginWithLinkedin method.
Passing requestPermissions or even an empty object helps as a workaround.

Unable to start meteor after pauli:accounts-linkedin

Hi, I am just starting learning how to allow user login in my Meteor using LinkedIn credential and this package. Before adding the package, I still able to run 'meteor -p 8080'. After adding the package, I got the error below. I am not sure the package causing this error so that I tried remove it. It works fine again after removing.

If you still actively working on this package, please assist. Appreciated.

Version: Meteor 1.4.2.7.

Error:
After meteor add pauli:accounts-linkedin, I have this:

Changes to your project's package version selections:                                              
accounts-base            added, version 1.2.14
accounts-oauth           added, version 1.1.15
ddp-rate-limiter         added, version 1.0.6
localstorage             added, version 1.0.12
oauth                    added, version 1.1.12
oauth2                   added, version 1.1.11
pauli:accounts-linkedin  added, version 1.3.1
pauli:linkedin           added, version 1.3.1
rate-limit               added, version 1.0.6
service-configuration    added, version 1.0.11                                              
pauli:accounts-linkedin: Accounts service for LinkedIn accounts

Then I start the app (without adding any new code yet)

tpham045:~/workspace/portfolio (LinkedInAPI) $ meteor -p 8080
W20170215-21:40:47.566(0)? (STDERR)           
W20170215-21:40:47.698(0)? (STDERR) /home/ubuntu/.meteor/packages/meteor-tool/.1.4.2_6.uykbpj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20170215-21:40:47.699(0)? (STDERR)                                             throw(ex);
W20170215-21:40:47.699(0)? (STDERR)                                             ^
W20170215-21:40:47.708(0)? (STDERR) MongoError: not authorized on heroku_5x9b24w5 to execute command { insert: "system.indexes", documents: [ { ns: "heroku_5x9b24w5.users", key: { username: 1 }, name: "username_1", unique: 1, sparse: 1 } ], ordered: true }
W20170215-21:40:47.708(0)? (STDERR)     at Object.Future.wait (/home/ubuntu/.meteor/packages/meteor-tool/.1.4.2_6.uykbpj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20170215-21:40:47.709(0)? (STDERR)     at MongoConnection._ensureIndex (packages/mongo/mongo_driver.js:828:10)
W20170215-21:40:47.709(0)? (STDERR)     at [object Object].Mongo.Collection._ensureIndex (packages/mongo/collection.js:685:20)
W20170215-21:40:47.709(0)? (STDERR)     at setupUsersCollection (packages/accounts-base/accounts_server.js:1491:9)
W20170215-21:40:47.710(0)? (STDERR)     at new AccountsServer (packages/accounts-base/accounts_server.js:51:5)
W20170215-21:40:47.710(0)? (STDERR)     at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
W20170215-21:40:47.711(0)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:181:9)
W20170215-21:40:47.711(0)? (STDERR)     at require (packages/modules-runtime.js:106:16)
W20170215-21:40:47.712(0)? (STDERR)     at /home/ubuntu/workspace/portfolio/.meteor/local/build/programs/server/packages/accounts-base.js:1972:15
W20170215-21:40:47.713(0)? (STDERR)     at /home/ubuntu/workspace/portfolio/.meteor/local/build/programs/server/packages/accounts-base.js:1983:3
W20170215-21:40:47.713(0)? (STDERR)     - - - - -
W20170215-21:40:47.713(0)? (STDERR)     at Function.MongoError.create (/home/ubuntu/.meteor/packages/npm-mongo/.2.2.11_2.8w0uvr++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/error.js:31:11)
W20170215-21:40:47.714(0)? (STDERR)     at /home/ubuntu/.meteor/packages/npm-mongo/.2.2.11_2.8w0uvr++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:483:72
W20170215-21:40:47.714(0)? (STDERR)     at authenticateStragglers (/home/ubuntu/.meteor/packages/npm-mongo/.2.2.11_2.8w0uvr++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:429:16)
W20170215-21:40:47.714(0)? (STDERR)     at [object Object].messageHandler (/home/ubuntu/.meteor/packages/npm-mongo/.2.2.11_2.8w0uvr++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:463:5)
W20170215-21:40:47.715(0)? (STDERR)     at Socket.<anonymous> (/home/ubuntu/.meteor/packages/npm-mongo/.2.2.11_2.8w0uvr++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/connection.js:309:22)
W20170215-21:40:47.715(0)? (STDERR)     at emitOne (events.js:77:13)
W20170215-21:40:47.716(0)? (STDERR)     at Socket.emit (events.js:169:7)
W20170215-21:40:47.716(0)? (STDERR)     at readableAddChunk (_stream_readable.js:153:18)
W20170215-21:40:47.716(0)? (STDERR)     at Socket.Readable.push (_stream_readable.js:111:10)
W20170215-21:40:47.717(0)? (STDERR)     at TCP.onread (net.js:537:20)
=> Exited with code: 1

Field name conflicts upon creating new user

I'm having a weird issue with Meteor.loginWithLinkedin function. I'm using Collection2 for Schema settings and my user.profile schema looks like that.

Schemas.UserProfile = new SimpleSchema({
    full_name: {
        type: String,
        regEx: /^[a-zA-Z -]{2,64}$/,
        optional: true
    },
    about: {
        type: String,
        defaultValue: ''
    },
    skills: {
        type: [Skills],
        optional: true
    },
});

The problem is with my skills array field in UserProfile. I'm using my own skills system and it works perfectly in app. But since LinkedIn also returns "skills" object upon authorization I get this error when creating new user:

I20150430-20:25:43.304(-4)? Exception while invoking method 'login' Error: Skills must be an array
I20150430-20:25:43.304(-4)?     at getErrorObject (packages/aldeed:collection2/collection2.js:369:1)
I20150430-20:25:43.304(-4)?     at [object Object].doValidate (packages/aldeed:collection2/collection2.js:352:1)
I20150430-20:25:43.305(-4)?     at [object Object].Mongo.Collection.(anonymous function) [as insert] (packages/aldeed:collection2/collection2.js:154:1)
I20150430-20:25:43.305(-4)?     at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1017:1)
I20150430-20:25:43.305(-4)?     at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1164:1)
I20150430-20:25:43.305(-4)?     at Object.updateOrCreateUserFromExternalService (packages/splendido:accounts-meld/lib/accounts-meld-server.js:635:1)
I20150430-20:25:43.305(-4)?     at [object Object].Package (packages/accounts-oauth/oauth_server.js:45:1)
I20150430-20:25:43.305(-4)?     at packages/accounts-base/accounts_server.js:358:1
I20150430-20:25:43.305(-4)?     at tryLoginMethod (packages/accounts-base/accounts_server.js:161:1)
I20150430-20:25:43.305(-4)?     at runLoginHandlers (packages/accounts-base/accounts_server.js:355:1)

When I'm removing "skills" field from UserProfile Schema, everything works fine and user is created and being logged in automatically.
I'm assuming that Meteor.loginWithLinkedin is trying to match the fields from response and insert them into profile automatically which I do not need (I'm using my own skill system).
I tried to bypass it with collection2 before filter hooks like that:

Meteor.users.before.insert(function(userId, user){
    if(typeof(user.services.linkedin) != "undefined"){
        console.log(user.services.linkedin);
        delete user.services.linkedin.skills;
    }
});

But this never gets called because the error happens before that hook.
Is there a way to prevent the UserProfile to be filled automatically with matching fields?

PS: I'm also using Meteor.loginWithGoogle in my app and don't have those issues.

Error: No matching login attempt found

I get the following error using meteor-accounts-linkedin only on mobile, using a Android/ Google Chrome 54.
When Linkedin redirects me to my app, the app cannot login.

message: No matching login attempt found [145546287]
stack:
Error: No matching login attempt found [145546287]
at [object Object]. (packages/accounts-oauth.js:113:21)
at packages/accounts-base/accounts_server.js:471:32
at tryLoginMethod (packages/accounts-base/accounts_server.js:248:14)
at AccountsServer.Ap.runLoginHandlers (packages/accounts-base/accounts_server.js:468:18)
at [object Object].methods.login (packages/accounts-base/accounts_server.js:531:27)
at [object Object].methodMap.(anonymous function) (packages/meteorhacks_kadira.js:2731:30)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1712:12)
at packages/ddp-server/livedata_server.js:711:19
at [object Object].
.extend.withValue (packages/meteor.js:1122:17)
at packages/ddp-server/livedata_server.js:709:40

https://ui.kadira.io/et/5cba73dd-bbd4-44c0-bff5-504eb116e2c4/qxeEaGEwHYCHvEMfP

linked in picture url

can any one guide how to access profile picture url in linkedin using pauli:accounts-linkedin

Missing LICENSE file

Same issue as mentioned in issue PoBuchi/meteor-linkedin#7. I've found a bug and would like to contribute a fix but need to know the license first.

I notice that your package is a fork of @yefim's package so I mentioning him here in hopes that he will indicate the license associated with his original repo.

There is an extra notice showing even when not needed

"Note: You're using accounts-ui and accounts-linkedin,
but didn't install the configuration UI for the LinkedIn
OAuth. You can install it with:
meteor add linkedin-config-ui"

is showing all the time, even if pauli:linkedin-config-ui is added and even if service-configuration is removed after everything is configured

OAuth Sever Error

2016-02-23 14:33:10-05:00{"line":"71","file":"oauth_server.js","message":"Unable to base64 decode state from OAuth query: undefined","time":{"$date":1456255990654},"level":"warn"}
73bw
2016-02-23 14:33:10-05:00{"line":"71","file":"oauth_server.js","message":"Unable to base64 decode state from OAuth query: undefined","time":{"$date":1456255990657},"level":"warn"}
73bw
2016-02-23 14:33:10-05:00{"line":"398","file":"oauth_server.js","message":"Error in OAuth Server: invalid_scope","time":{"$date":1456255990659},"level":"warn"}

this doesn't work for me on weworkmeteor.com - i get the above error when trying to log in - the oauth window pops open for a moment, the closes by itself before the linkedin login prompt is displayed

i've disabled linkedin login on weworkmeteor - if you need to replicate, let me know and i'll turn it back on for you

Existing users get new accounts when logging in

This issue was reported on stackoverflow. The problem is that pauli:linkedin retrieved user IDs from the wrong place and LinkedIn recently changed the values stored in that place. As a result, existing users have a value in services.linkedin.id that doesn't correspond to anything that LinkedIn returns as part of an OAuth response. As a result, the IDs of all existing users need to migrated, if possible.

Proposed fix:

  1. Add a services.linkedin.idIsFixed property and index it for efficiency.
  2. On the server at startup, for each account which has a value for services.linkedin.id but doesn't have a value of true for services.linkedin.idIsFixed:
    1. Use services.linkedin.accessToken to request the user's correct id from LinkedIn.
    2. Update services.linkedin.id with the obtained value, and set services.linkedin.idIsFixed to true.

There are 2 wrinkles in this plan:

  1. Some users will have multiple accounts because they attempted to log in before the fix was deployed. The old account will probably have more app information associated with it, but the new account will have more recent app info associated with it. Which account should the user be logged into in the future and what should happen to the other account? Maybe we should allow the app to register a callback that is called when this situation is encountered?
  2. Some access tokens may have expired. I think the access tokens expire after about 60 days. So, if a user last signed in with LinkedIn more than about 60 days before the migration occurs, his ID would not be fixed by the migration. Depending on the app's configuration, such a user might be able to continue to access his account using other login services (e.g. using his Meteor "resume" login tokens from a computer where he previously logged in). We could conceivably detect when such a user logs in, and require that they sign in to LinkedIn again and replace his services.linkedin info. My brettle:accounts-add-service package might be useful for such a case. Regardless, this wouldn't handle users who don't have any other way of accessing their account. When such a user logs in with LinkedIn, we could see whether his publicProfileUrl matches that of an existing account, and if it does, update the ID on that account and log the user into it. Of course, this will only work if LinkedIn hasn't and doesn't change the format of that URL.

Thoughts?

Having difficulties using Meteor 1.6.1

Hi! I installed the package and are now getting this error... used to work a while ago but I'm not sure which version of Meteor may have presented the issue first.

I get no error on the MEteor server console, but I do get this error on the Client side (other logins work... Facebook, Google, Twitter), so I wonder if there might be an incompatibility issue between Meteor 1.6.1, and your package.

Thanks by the way!

accounts-ui-unstyled.js:1245 Uncaught TypeError: loginWithService is not a function
at Object.click .login-button (accounts-ui-unstyled.js:1245)
at blaze.js:3775
at Function.Template._withTemplateInstanceFunc (blaze.js:3744)
at Blaze.View. (blaze.js:3774)
at blaze.js:2617
at Object.Blaze._withCurrentView (blaze.js:2271)
at Blaze._DOMRange. (blaze.js:2616)
at HTMLDivElement. (blaze.js:863)
at HTMLDivElement.dispatch (jquery.js:4721)
at HTMLDivElement.elemData.handle (jquery.js:4389)

How to get access-token after login into the linkedin?

I added meteor add pauli:accounts-linkedin in my meteor application and Configured like below

Template.Login.events({
'click #login-with-linkedin' : function () {
Meteor.loginWithLinkedIn({
requestPermissions: ['r_basicprofile','r_emailaddress']
}, function(err){
if(err){
console.log('error with login is: ', err);
}else{
var user = Meteor.user();
console.log(user);
//In user object I'M able to see the basic information,but how can i get the accesstoken
//Here i want to redirect my dashboard page
}

});

}
});
How can i get the access token ?

Uncaught TypeError: undefined is not a function social.coffee

On button click I get the following error

Uncaught TypeError: undefined is not a function social.coffee:54Template.entrySocial.events.click .btn social.coffee:54(anonymous function) template.js:272(anonymous function) view.js:746Blaze._withCurrentView view.js:404(anonymous function) view.js:745(anonymous function) events.js:47jQuery.event.dispatch jquery.js:4624elemData.handle

Create option in configuration to return cleaned up data

As Linkedin api changed quite a bit, are there a need to get data cleaned up after oauth call.

So if in `ServiceConfiguration.configurations` pass extra option, like `cleanedUpData:true` it will return:
profile: {
   firstName: 'Jon',
   lastName:  'Doe'
   linkedinId: 'id',
   email: '[email protected]',
   picture: 'singleUrl' // specify wich identifier you want first or last(last one is with highest res)
}

Any thoughts?

Unable to parse state from OAuth query

Hi, I'm getting the following error while trying out this package and not able to login with LinkedIn.

Unable to parse state from OAuth query: ?<i?rV↨iOZ♥OWj1.t♀?m½ nxµ&E¡⌂áAR
Unable to parse state from OAuth query: ?<i?rV↨iOZ♥OWj1.t♀?m½ nxµ&E¡⌂áAR
Unable to parse state from OAuth query: ?<i?rV↨iOZ♥OWj1.t♀?m½ nxµ&E¡⌂áAR
Error in OAuth Server: Failed to complete OAuth handshake with LinkedIn. failed [400] {"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired","error":"invalid_request"}

Here's my server side configuration

      ServiceConfiguration.configurations.remove({
            service: "linkedin"
       });
        ServiceConfiguration.configurations.insert({
            service: "linkedin",
            clientId: <my clientid>,
            secret: <my secret>
        });

And on client side event I do

 Meteor.loginWithLinkedin({}, function(err) {
        if (err) {
            console.log("ERROR: ", err.message); //error handling
        } else {
            console.log("NO ERROR ON LOGIN");
        }
    });

Saw this error here as well

yubozhao/meteor-accounts-instagram#3

Option to ignore getImage function

Hi,

I noticed that the package, for me at least, fails to function with LinkedIn profiles without a profile picture. Could this issue be addressed as profile picture is an optional field in LinkedIn and it is not unheard of that people do not add a profile pic.

I went through the compiled code and it seems that there is no option to disable getImage() function from being called? If I am mistaken, and it is simple, could you provide an example in the README.md.

Thanks in advance.

"loginWithService is not a function" @2.0.0

Hi there,

after updating to 2.0.0 alongside Meteor 1.4.3.1, it seems like an ID somewhere isn't set properly for the accounts-core package to execute loginWithService().

Interestingly enough, downgrading to 1.3.1 works once again without a hitch, even with Meteor 1.4.3.1.

EDIT: Logging in works again by downgrade, but logging out doesn't - there is no error. Is this just me?

mainerror
sourceerror

Name or email not showing, in UI.

I have used meteor official accounts-ui, accounts-password, accounts-facebook and this linkedin package, but only in case of linkedin, after logging in, in the login hyperlink, name/email does not show up, only a down arrow. (as can be seen in top left corner of screenshot.), where as in case of facebook, name shows, and in case of accounts-password, email shows up.
screenshot from 2015-12-15 12 58 12

Bad data on login

Hello package works great, but for some reason it creates bad data on register/login: profile.name : "[object Object] [object Object]"

Is there any possibility to get response in the callback function, so I can maybe call a method to get the correct data?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.