Linkedin 未捕获错误:您必须指定有效的 JavaScript API 域作为此密钥配置的一部分

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28506603/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 09:05:37  来源:igfitidea点击:

linkedin Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration

javascriptapiauthenticationlinkedin

提问by S Renzler

I have followed the instructions listed here in the 10 minute instructions: guideAnd the help from stackoverflow listed here: stackanswer

我已按照此处列出的 10 分钟说明中列出的说明进行操作:指南以及此处列出的来自 stackoverflow 的帮助:stackanswer

I still get this error:

我仍然收到此错误:

Console.log error:

Console.log 错误:

Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.

未捕获的错误:您必须指定有效的 JavaScript API 域作为此密钥配置的一部分。

My Code is this:

我的代码是这样的:

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


Where the api_key value is the value of Consumer Key / API Key from my app. And for the JavaScript API Domains I listed: http://mediaproof360.com,http://www.mediaproof360.com

其中 api_key 值是我的应用程序中消费者密钥/API 密钥的值。对于我列出的 JavaScript API 域:http://mediaproof360.com,http://www.mediaproof360.com

After a day of research and trial and error I am hitting a wall.

经过一天的研究和反复试验,我遇到了困难。

Help is appreciated greatly. I have created a second app with credentials using that new API but still no luck.

非常感谢帮助。我已经使用该新 API 创建了带有凭据的第二个应用程序,但仍然没有运气。

回答by Rejeesh

You can try this code

你可以试试这个代码

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

No quotes with api key will work. Add this section in the <head>element.

没有带 api 键的引号将起作用。在<head>元素中添加此部分。

回答by Green

Had the same error message thrown by Linkedn. Though my solution appeared to be different.

Linkedn 抛出了相同的错误消息。虽然我的解决方案似乎有所不同。

I didn't specify my app's domain in settings. After I added it, all started working well. Pay attention to trailing slash. It may also cause errors

我没有在设置中指定我的应用程序域。在我添加它之后,一切都开始运行良好。注意尾部斜线。也可能导致错误

enter image description here

在此处输入图片说明

Link to your apps https://www.linkedin.com/developer/apps/.

链接到您的应用程序 https://www.linkedin.com/developer/apps/

回答by morunas

Adding to @Rejeesh 's correct answer above, if you happen to echo the api_key from a configuration file and have other parameters such as "authorize: true" remember to add an end of line. For example, with PHP:

添加到上面@Rejeesh 的正确答案中,如果您碰巧从配置文件中回显了 api_key 并具有其他参数,例如“authorize: true”,请记住添加行尾。例如,使用 PHP:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: <?php echo LINKEDIN_API_KEY . PHP_EOL; ?>
    authorize: true
</script>

If you don't do this you risk getting it all in the same line and you would also get the same error (your key would be invalid).

如果您不这样做,您就有可能将所有内容都放在同一行中,并且您还会遇到相同的错误(您的密钥将无效)。

回答by Shady Sherif

Adding to @Rejeesh 's and morunas's correct answers you may need to check your application java script settings and add your domain their as mentioned in Linkedin documentation

添加到@Rejeesh 和 morunas 的正确答案中,您可能需要检查您的应用程序 java 脚本设置并添加您的域,如 Linkedin 文档中所述

https://developer.linkedin.com/docs/getting-started-js-sdk#initialize

https://developer.linkedin.com/docs/getting-started-js-sdk#initialize