LinkedIn JavaScript SDK“您必须指定有效的JavaScript API域作为此密钥的配置的一部分." [英] LinkedIn JavaScript SDK "You must specify a valid JavaScript API Domain as part of this key's configuration."
问题描述
我想在我们的网站上显示LinkedIn公司的最新更新.因此,我按照以下步骤操作,以与LinkedIn JavaScript SDK @ https://developer集成.linkedin.com/docs/getting-started-js-sdk .我主要执行以下步骤:-
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-我创建了一个新的应用程序.
1- I created a new application .
2-然后我将以下域添加到有效的SDK域"中.由于我要在其中显示linkedin数据的站点是一个共享点在线站点,该站点具有以下URL https://ourcompanyname.sharepoint.com
:-
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
:-
3-然后在我的共享点页面中,添加了以下脚本,以从LinkedIn获得信息:-
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
编辑
现在,根据@Lars Hendriks的建议,我等待了2个小时,可以看到您必须指定一个有效的JavaScript API域作为此键的配置的一部分.错误不再显示在浏览器F12中安慰.但同时我看不到JavaScript调用返回的任何数据,即使alert("2")
&我上面的JavaScript中的alert(id)
没有弹出.
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 ?
推荐答案
您可以尝试的是:
<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 :
注册API密钥并指定有效域后,它可能 更改最多需要30分钟才能生效,因此如果更改没有生效 立即工作,去喝杯咖啡,然后再检查几杯.
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.
这篇关于LinkedIn JavaScript SDK“您必须指定有效的JavaScript API域作为此密钥的配置的一部分."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!