2014-01-24 64 views
7

我尝试使用LinkedIn共享选项和回调选项创建MVC4应用程序。您必须指定一个有效的JavaScript API域作为此密钥配置的一部分。在LinkedIn

我用我的应用程序ID在我的Layout.cshtml中引用我的脚本。

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

但萤火虫显示消息像下面的图片

enter image description here

,但我相信我的AppID是正确的。我不知道出现这个错误的原因是什么。

编辑

我把单引号

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

内API_KEY但我得到的萤火

错误不同:API密钥无效抛出新的错误(“API密钥无效“);

任何格式都需要在API中放置API密钥。

请帮忙。

回答

8

您的API密钥看起来有点短...

您刚刚注册了您的API密钥吗?根据尤金奥尼尔this forum

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域。

他概述了全系列的步骤如下:

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)

+0

非常感谢您,先生您的宝贵答案......我有一个API密钥它是在上个月创造。我删除了现有的密钥并为我的Web应用程序创建了一个新的应用程序。我遵循你的指示非常感谢你。 –

+0

太棒了!很高兴帮助:) – Gopherkhan

+0

嗨,先生,你有没有使用任何JavaScript API共享内容linkedIn与成功回调选项。请当你看到这个时告诉我。谢谢。 –

12

周围apikey删除引号。那就是问题所在。

+0

解决了我的问题..非常感谢。 – Gary

+0

谢谢!这优雅的答案解决了我的问题。 – Xinan

+0

浪费了整整一天的时间。我是那个笨蛋还是它的文档? – ali

11

在这种形式:

JavaScript Settings

你必须输入你的域名,单击添加,并通过点击更新按钮进行确认。

我没有这样做的第一次。即使我的域出现在屏幕上,他们也没有提交。

我也遇到了这个问题。

当我意识到LinkedIn首先不保存我的“有效的SDK域”时,我正在调试一小时的问题。

+0

尾随斜线?必须或不能在场?因为对于Twitter来说,尾随斜线是错误原因。 – Green

+0

你的回答为我解决了这个问题。我的网址有一个斜线。 – Green

+0

为第一时间,点击“添加”,然后点击“更新”按钮。 –

0

要加上Paul Nowak正确的answer,这有助于解决我的问题。

不要忘了在这里设置正确的网址。

菜单选项

enter image description here

和URL这里

enter image description here

相关问题