LinkedIn oauth error A required parameter “client_id” is missing
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
add a comment |
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
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
add a comment |
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
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
javascript node.js axios linkedin
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
));
1
This fixed it! Thanks :)
– petermir
Nov 15 '18 at 22:25
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
));
1
This fixed it! Thanks :)
– petermir
Nov 15 '18 at 22:25
add a comment |
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
));
1
This fixed it! Thanks :)
– petermir
Nov 15 '18 at 22:25
add a comment |
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
));
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
));
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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