ArkeologeN / node-linkedin

LinkedIn 2.0 wrapper in Node.js
MIT License
163 stars 78 forks source link

People search functionality #64

Closed medlot closed 8 years ago

medlot commented 8 years ago

Hello,

I'm trying to implement the search people function but I have an issue with the parameters to pass. Can you help me on that please.

Please find below my code:

`router.get('/linkedin1', function(req, res) {

Linkedin.setCallback('http://localhost:3000/linkedin');
var scope = ['r_basicprofile','r_network','rw_company_admin','w_share','r_emailaddress'];
Linkedin.auth.authorize(res, scope, '2334321');

});

router.get('/linkedin', function(req, res) {

Linkedin.auth.getAccessToken(res, req.query.code, req.query.state, function(err, results) {
    if ( err )
        return console.error(err);

            var linkedin = Linkedin.init(results.access_token || results.accessToken);
    linkedin.people.search('first-name=mohamed,last-name=mohamed', function(err, $in) {
        console.log($in);
         });
});

}); `

In fact I get this issue

GET /linkedin1 302 16.900 ms - 562 { [CSRF Alert: Possible CSRF attack, state parameters do not match.] name: 'CSRF Alert' } GET /linkedin?error=invalid_scope&error_description=Your+application+has+not+been+authorized+for+the+scope+%22r_network%22 - - ms - -

Thank you for your help!

ArkeologeN commented 8 years ago

Please follow this: https://github.com/ArkeologeN/node-linkedin/blob/d2f91c903e5f540c4f5361a6d68af8cc9a36567f/lib/services/people.js#L60

medlot commented 8 years ago

yes I have followed that, I made a mistake on the options?

Thank you for your help!

medlot commented 8 years ago

or it's an autorisation issue with r_network?

error=invalid_scope&error_description=Your+application+has+not+been+authorized+for+the+scope+%22r_network%22 - - ms - -

ArkeologeN commented 8 years ago

Yes, the error you show means your application doesn't authorize to use r_network scope.

medlot commented 8 years ago

so linkedin is no more supporting r_network that is required for search people. There is other solution?