John John
John John

Reputation: 1

LinkedIn JavaScript SDK "You must specify a valid JavaScript API Domain as part of this key's configuration."

I want to show our LinkedIn company recent updates inside our web site. so i follow these steps, to integrate with LinkedIn JavaScript SDK @ https://developer.linkedin.com/docs/getting-started-js-sdk . mainly i did the following steps:-

1- I created a new application .

2- then i add the following domains inside the "Valid SDK Domains". since the site i want to show the linkedin data inside it is a sharepoint online site which has the following url https://ourcompanyname.sharepoint.com :-

enter image description here

3- then inside my sharepoint page , i added the following script, to get the information from LinkedIn:-

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:   0**********c
</script>
<script>
alert("1");
    var liLogin = function() { // Setup an event listener to make an API call once auth is complete
        IN.UI.Authorize().params({"scope":["r_basicprofile", "r_emailaddress"]}).place();
        IN.Event.on(IN, 'auth', getProfileData);
    }

    var getProfileData = function() { // Use the API call wrapper to request the member's basic profile data
    alert("2");
        IN.API.Profile("me").fields("id,firstName,lastName,email-address,picture-urls::(original),public-profile-url,location:(name)").result(function (me) {
            var profile = me.values[0];
            var id = profile.id;
            var firstName = profile.firstName;
            var lastName = profile.lastName;
            var emailAddress = profile.emailAddress;
            var pictureUrl = profile.pictureUrls.values[0];
            var profileUrl = profile.publicProfileUrl;
            var country = profile.location.name;
            alert(id);
        });
    }
</script>


<p>testing</p>

but on the browser i got the following error:-

Error: You must specify a valid JavaScript API Domain as part of this key's configuration. userspace:22:9
<anonymous>
https://www.linkedin.com/uas/js/userspace:22:9
<anonymous>
https://www.linkedin.com/uas/js/userspace:1:2

EDIT Now based on @Lars Hendriks advice, i waited for 2 hours and i can see that the You must specify a valid JavaScript API Domain as part of this key's configuration. error is no longer showing inside my browser F12 console. but at the same time i can not see any data returned from the JavaScript call, even the alert("2") & alert(id) inside my above JavaScript did not get popup.. not sure what is going on ?

Upvotes: 0

Views: 709

Answers (1)

Lars Hendriks
Lars Hendriks

Reputation: 1058

what you could try is :

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:   0**********c 
    authorize: true
</script>

if this does not work , you might want to have to wait :

After registering an API key and specifying a valid domain, it may take up to 30 minutes for the changes to take affect, so if it doesn't work immediately, go grab a coffee and check back in a few.

Upvotes: 1

Related Questions