LinkedIn JavaScript SDK"您必须指定一个有效的JavaScript API域作为此密钥配置的一部分. [英] LinkedIn JavaScript SDK "You must specify a valid JavaScript API Domain as part of this key's configuration."

查看:65
本文介绍了LinkedIn JavaScript SDK"您必须指定一个有效的JavaScript API域作为此密钥配置的一部分.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我们的网站上显示LinkedIn公司的最新更新.因此,请按照以下步骤操作,以与LinkedIn JavaScript SDK @

3-然后在我的共享点页面中,添加了以下脚本,以从LinkedIn获得信息:-

 < script type ="text/javascript"src ="//platform.linkedin.com/in.js">api_key:0 ********** c</script>< script>警报("1");var liLogin = function(){//设置事件监听器,以在身份验证完成后进行API调用IN.UI.Authorize().params({"scope":["r_basicprofile","r_emailaddress"]}).place();IN.Event.on(IN,'auth',getProfileData);}var getProfileData = function() {//使用 API 调用包装器来请求会员的基本资料数据警报("2");IN.API.Profile(我").fields("id,名字,姓氏,电子邮件地址,图片网址::(原始),公共概况网址,位置:(名称)").结果(功能(我){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;警报(ID);});}</script>< p>测试</p> 

但是在浏览器上我遇到以下错误:-

 错误:您必须指定一个有效的JavaScript API域作为此密钥的配置的一部分.用户空间: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)没有弹出.

解决方案

您可以尝试的是:

 <脚本类型="text/javascript" src ="//platform.linkedin.com/in.js">api_key:0 ********** c授权:正确</script> 

如果这不起作用,您可能需要等待:

注册API密钥并指定有效域后,它可能更改最多需要30分钟才能生效,因此如果更改没有生效立即工作,去喝杯咖啡,然后再检查几杯.

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 :-

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 ?

解决方案

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.

这篇关于LinkedIn JavaScript SDK&quot;您必须指定一个有效的JavaScript API域作为此密钥配置的一部分.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆