LinkedIn oauth error A required parameter “client_id” is missing










2















so I am just upgrading from LinkedIn oauth 1.0 to 2.0 and I have been getting this error for about a day now. I saw a post about it for php but I cannot figure it out in Node JS (Javascript) here is my current code :



axios
.post("https://www.linkedin.com/oauth/v2/accessToken",
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
)
.then(res2 =>
console.log(res2);
)
.catch(error =>
console.log(error);
);


If you have any ideas let me know :)



Link to php solution: LinkedIn OAuth a required parameter "clien_id" is missing



Link to LinkedIn guide: https://developer.linkedin.com/docs/oauth2
(error occurring on step 3)










share|improve this question
























  • what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

    – DaniDev
    Nov 15 '18 at 21:46











  • keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

    – petermir
    Nov 15 '18 at 21:54











  • your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

    – DaniDev
    Nov 15 '18 at 22:18











  • In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

    – petermir
    Nov 15 '18 at 22:21















2















so I am just upgrading from LinkedIn oauth 1.0 to 2.0 and I have been getting this error for about a day now. I saw a post about it for php but I cannot figure it out in Node JS (Javascript) here is my current code :



axios
.post("https://www.linkedin.com/oauth/v2/accessToken",
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
)
.then(res2 =>
console.log(res2);
)
.catch(error =>
console.log(error);
);


If you have any ideas let me know :)



Link to php solution: LinkedIn OAuth a required parameter "clien_id" is missing



Link to LinkedIn guide: https://developer.linkedin.com/docs/oauth2
(error occurring on step 3)










share|improve this question
























  • what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

    – DaniDev
    Nov 15 '18 at 21:46











  • keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

    – petermir
    Nov 15 '18 at 21:54











  • your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

    – DaniDev
    Nov 15 '18 at 22:18











  • In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

    – petermir
    Nov 15 '18 at 22:21













2












2








2








so I am just upgrading from LinkedIn oauth 1.0 to 2.0 and I have been getting this error for about a day now. I saw a post about it for php but I cannot figure it out in Node JS (Javascript) here is my current code :



axios
.post("https://www.linkedin.com/oauth/v2/accessToken",
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
)
.then(res2 =>
console.log(res2);
)
.catch(error =>
console.log(error);
);


If you have any ideas let me know :)



Link to php solution: LinkedIn OAuth a required parameter "clien_id" is missing



Link to LinkedIn guide: https://developer.linkedin.com/docs/oauth2
(error occurring on step 3)










share|improve this question
















so I am just upgrading from LinkedIn oauth 1.0 to 2.0 and I have been getting this error for about a day now. I saw a post about it for php but I cannot figure it out in Node JS (Javascript) here is my current code :



axios
.post("https://www.linkedin.com/oauth/v2/accessToken",
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
)
.then(res2 =>
console.log(res2);
)
.catch(error =>
console.log(error);
);


If you have any ideas let me know :)



Link to php solution: LinkedIn OAuth a required parameter "clien_id" is missing



Link to LinkedIn guide: https://developer.linkedin.com/docs/oauth2
(error occurring on step 3)







javascript node.js axios linkedin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 21:56







petermir

















asked Nov 15 '18 at 21:42









petermirpetermir

579




579












  • what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

    – DaniDev
    Nov 15 '18 at 21:46











  • keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

    – petermir
    Nov 15 '18 at 21:54











  • your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

    – DaniDev
    Nov 15 '18 at 22:18











  • In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

    – petermir
    Nov 15 '18 at 22:21

















  • what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

    – DaniDev
    Nov 15 '18 at 21:46











  • keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

    – petermir
    Nov 15 '18 at 21:54











  • your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

    – DaniDev
    Nov 15 '18 at 22:18











  • In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

    – petermir
    Nov 15 '18 at 22:21
















what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

– DaniDev
Nov 15 '18 at 21:46





what value are you submitting for clien_id (i.e. what is 'keys.linkedinConsumerKey')?

– DaniDev
Nov 15 '18 at 21:46













keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

– petermir
Nov 15 '18 at 21:54





keys.linkedinConsumerKey is the app id given by linkedin. LinkedinConsumerKey is a poor variable name.

– petermir
Nov 15 '18 at 21:54













your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

– DaniDev
Nov 15 '18 at 22:18





your error seems to be telling you that the clien_id is not getting passed. Try to catch what value are you passing?

– DaniDev
Nov 15 '18 at 22:18













In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

– petermir
Nov 15 '18 at 22:21





In the consloe.log(error); I can see what the request and client_id is passed in with the correct variable.

– petermir
Nov 15 '18 at 22:21












1 Answer
1






active

oldest

votes


















1














The LinkedIn documentation ask you to send the data as a application/x-www-form-urlencoded and they show us this exemple:



POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


The Axios documentation says that by default the body is serialized as JSON:




By default, axios serializes JavaScript objects to JSON.




In order to serialize the body properly you should use the querystring module as following:



const querystring = require('querystring');

axios
.post("https://www.linkedin.com/oauth/v2/accessToken", querystring.stringify(
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
));





share|improve this answer


















  • 1





    This fixed it! Thanks :)

    – petermir
    Nov 15 '18 at 22:25










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328295%2flinkedin-oauth-error-a-required-parameter-client-id-is-missing%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The LinkedIn documentation ask you to send the data as a application/x-www-form-urlencoded and they show us this exemple:



POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


The Axios documentation says that by default the body is serialized as JSON:




By default, axios serializes JavaScript objects to JSON.




In order to serialize the body properly you should use the querystring module as following:



const querystring = require('querystring');

axios
.post("https://www.linkedin.com/oauth/v2/accessToken", querystring.stringify(
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
));





share|improve this answer


















  • 1





    This fixed it! Thanks :)

    – petermir
    Nov 15 '18 at 22:25















1














The LinkedIn documentation ask you to send the data as a application/x-www-form-urlencoded and they show us this exemple:



POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


The Axios documentation says that by default the body is serialized as JSON:




By default, axios serializes JavaScript objects to JSON.




In order to serialize the body properly you should use the querystring module as following:



const querystring = require('querystring');

axios
.post("https://www.linkedin.com/oauth/v2/accessToken", querystring.stringify(
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
));





share|improve this answer


















  • 1





    This fixed it! Thanks :)

    – petermir
    Nov 15 '18 at 22:25













1












1








1







The LinkedIn documentation ask you to send the data as a application/x-www-form-urlencoded and they show us this exemple:



POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


The Axios documentation says that by default the body is serialized as JSON:




By default, axios serializes JavaScript objects to JSON.




In order to serialize the body properly you should use the querystring module as following:



const querystring = require('querystring');

axios
.post("https://www.linkedin.com/oauth/v2/accessToken", querystring.stringify(
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
));





share|improve this answer













The LinkedIn documentation ask you to send the data as a application/x-www-form-urlencoded and they show us this exemple:



POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


The Axios documentation says that by default the body is serialized as JSON:




By default, axios serializes JavaScript objects to JSON.




In order to serialize the body properly you should use the querystring module as following:



const querystring = require('querystring');

axios
.post("https://www.linkedin.com/oauth/v2/accessToken", querystring.stringify(
grant_type: "authorization_code",
code: req.query.code,
redirect_uri: keys.linkedinCallbackURL,
client_id: keys.linkedinConsumerKey,
client_secret: keys.linkedinConsumerSecret
));






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 22:23









Yannick LoriotYannick Loriot

6,34622851




6,34622851







  • 1





    This fixed it! Thanks :)

    – petermir
    Nov 15 '18 at 22:25












  • 1





    This fixed it! Thanks :)

    – petermir
    Nov 15 '18 at 22:25







1




1





This fixed it! Thanks :)

– petermir
Nov 15 '18 at 22:25





This fixed it! Thanks :)

– petermir
Nov 15 '18 at 22:25



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328295%2flinkedin-oauth-error-a-required-parameter-client-id-is-missing%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党