I've gone through steps 1 and 2 of linkedin OAuth2 authentication (detailed here https://developer.linkedin.com/docs/oauth2), but I am unable to retrieve an access token in step three. I am using a node.js server with express.js to make an https post request to the https://www.linkedin.com/uas/oauth2/accessToken
endpoint with all the parameters listed in the docs. My code for the request is:
// Request paramaters
var post_data = querystring.stringify({
'grant_type' : 'authorization_code',
'code': auth_code,
'redirect_uri': 'http://localhost:4200/authenticated',
'client_id': '**************',
'client_secret': '****************'
});
// Request options object
var post_options = {
host: 'www.linkedin.com',
port: '443',
path: '/uas/oauth2/accessToken',
method: 'POST'
};
// Setup the request
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('Response: ' + chunk);
});
});
// Post the data
post_req.write(post_data);
post_req.end();
However, upon making the request the server logs the following error response from linkedin:
Response: {"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : client_id","error":"invalid_request"}
github
repo for mean-passport-auth i developed this couple of days back for role based local and Facebook authentication. I think you can get an idea and implement same thing in EmberJS. To add to it. I will be improving this app in a week or so to feature ** javascript web token(JWT) ** based authentication. That will be the best. So try to achieve same. All the best. – NarendraSoni