您必须指定有效的 JavaScript API 域作为此密钥配置的一部分。在领英
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21325798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
You must specify a valid JavaScript API Domain as part of this key's configuration. in LinkedIn
提问by Ragesh S
I try to create a MVC4 application with LinkedIn share option with callback option.
我尝试创建一个带有 LinkedIn 共享选项和回调选项的 MVC4 应用程序。
i refer my script in my Layout.cshtml with my app id.
我在我的 Layout.cshtml 中使用我的应用程序 ID 引用我的脚本。
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: APIkeyGOEShere
</script>
<script type="text/javascript">
function testme(count) {
alert("That document has been shared: " + count + " times");
}
</script>
But the firebug shows a message like below image
但萤火虫显示如下图所示的消息
But i am sure my AppID is correct. I don't know what is the reason to appear this error.
但我确定我的 AppID 是正确的。我不知道出现这个错误的原因是什么。
Edits
编辑
I place the api_key inside the single quote
我将 api_key 放在单引号内
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 'APIkeyGOEShere'
</script>
But i get a different in firebug
但我在萤火虫中得到了不同的
Error: API Key is invalid throw new Error("API Key is invalid");
错误:API Key 无效 throw new Error("API Key is invalid");
Any format need to place API key inside of the javascript.
任何格式都需要将 API 密钥放在 javascript 中。
Please help.
请帮忙。
回答by Vicky
Remove the quotes around apikey. That is the problem.
删除 apikey 周围的引号。那就是问题所在。
回答by Paul Nowak
In this form:
以这种形式:
You have to enter your domain, click Add, and confirm by clicking Updatebutton.
您必须输入您的域,单击“添加”,然后单击“更新”按钮进行确认。
I didn't do that for the first time. And even though my domains appeared in the screen, they weren't submitted.
我不是第一次这样做。即使我的域出现在屏幕上,它们也没有被提交。
I run into this problem as well.
我也遇到了这个问题。
I was debugging the problem for an hour when I realized that LinkedIn doesn't save my "Valid SDK Domain" in the first place.
当我意识到 LinkedIn 首先没有保存我的“有效 SDK 域”时,我调试了一个小时的问题。
回答by Gopherkhan
Your API key looks a bit short...
您的 API 密钥看起来有点短...
Did you just register your API key? According to Eugene O'Neill on this forum:
您是否刚刚注册了 API 密钥?根据 Eugene O'Neill 在这个论坛上的说法:
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.
注册 API 密钥并指定有效域后,更改最多可能需要 30 分钟才能生效,因此如果它不能立即生效,请喝杯咖啡,然后再回来查看。
Also, make sure you specified your API Domain.
此外,请确保您指定了 API 域。
He outlines the full series of steps as follows:
他概述了整个系列的步骤如下:
To register an API key:
head over to https://www.linkedin.com/secure/developer
log in and click the link to Add New Application
fill out the following info:
Company (choose from the dropdown)
Application Name (e.g. My Company Jobs)
Description (e.g. For receiving applications from job applicants)
JavaScript API Domain (this is an important step. this is the website the button will go on e.g. http://www.mycompany.com)
Application Use (select one from the list, if nothing matches your needs, choose "other")
Developer Contact Email (your email address)
Phone (a phone number you can be reached at if there are issues with the account)
check "I agree" Security text (enter the characters you see just above it)
要注册 API 密钥:
前往https://www.linkedin.com/secure/developer
登录并单击添加新应用程序的链接
填写以下信息:
公司(从下拉菜单中选择)
应用程序名称(例如我的公司工作)
描述(例如用于接收求职者的申请)
JavaScript API 域(这是重要的一步。这是按钮所在的网站,例如http://www.mycompany.com)
应用程序使用(从列表中选择一个,如果没有符合您的需求,请选择“其他”)
开发人员联系电子邮件(您的电子邮件地址)
电话(如果帐户有问题,可以联系到您的电话号码)
选中“我同意”安全文本(输入您在其上方看到的字符)