linkedin Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration
Asked Answered
S

4

28

I have followed the instructions listed here in the 10 minute instructions: guide And the help from stackoverflow listed here: stackanswer

I still get this error:

Console.log error:

Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.

My Code is this:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:'98eeeu4fd587w4'
</script>

Where the api_key value is the value of Consumer Key / API Key from my app. And for the JavaScript API Domains I listed: http://mediaproof360.com,http://www.mediaproof360.com

After a day of research and trial and error I am hitting a wall.

Help is appreciated greatly. I have created a second app with credentials using that new API but still no luck.

Sterigma answered 13/2, 2015 at 18:49 Comment(3)
Configure your LinkedIn application for JavaScript SDK use This is done by adding your domain(s) to the "JavaScript API Domains" field in your application's configuration:Ilan
@Rejeesh look aboveIlan
Just to clarify. You must use "Client ID"(found in Authentication in your app configs) as api_key value. If you put a different value, and set correct the "JavaScript API Domains", you will still see the same error.Pouched
N
66

You can try this code

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: 98eeeu4fd587w4
</script>

No quotes with api key will work. Add this section in the <head> element.

Nebulose answered 18/2, 2015 at 5:33 Comment(4)
Marking it as answer may help someone else to find it easily :)Nebulose
The error message totally takes you in the wrong direction. Thanks :)Moia
So, how do I make this dynamic. In other words, I want to add a variable name as the value like: api_key:$linkedinApiKeyAlike
That's not even JavaScript, the SDK's very nasty here.Wishywashy
D
15

Had the same error message thrown by Linkedn. Though my solution appeared to be different.

I didn't specify my app's domain in settings. After I added it, all started working well. Pay attention to trailing slash. It may also cause errors

enter image description here

Link to your apps https://www.linkedin.com/developer/apps/.

Disquieting answered 3/11, 2017 at 8:30 Comment(0)
F
11

Adding to @Rejeesh 's correct answer above, if you happen to echo the api_key from a configuration file and have other parameters such as "authorize: true" remember to add an end of line. For example, with PHP:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: <?php echo LINKEDIN_API_KEY . PHP_EOL; ?>
    authorize: true
</script>

If you don't do this you risk getting it all in the same line and you would also get the same error (your key would be invalid).

Favus answered 12/8, 2015 at 10:37 Comment(0)
S
1

Adding to @Rejeesh 's and morunas's correct answers you may need to check your application java script settings and add your domain their as mentioned in Linkedin documentation

https://developer.linkedin.com/docs/getting-started-js-sdk#initialize

Sedan answered 14/4, 2017 at 4:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.