[英]Linkedin SDK You must specify a valid JavaScript API Domain as part of this key's configuration
I created an application in linkedin developers and set OAuth 2.0 redirect urls as http://localhost:8080/
and http://localhost:8080/myProject/
. 我在linkedin开发人员中创建了一个应用程序,并将OAuth 2.0重定向URL设置为http://localhost:8080/
和http://localhost:8080/myProject/
。 Then I wrote <script>
in <head>
section: 然后我在<head>
部分写了<script>
:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 86g3tbk6gy0y56
onLoad: liLogin()
authorize: yes
</script>
Also I wrote one more <script>
at the bottom of the page: 我还在页面底部再写了一个<script>
:
<script>
var liLogin = function() {
IN.UI.Authorize().params({"scope":["r_basicprofile", "r_emailaddress"]}).place();
IN.Event.on(IN, 'auth', getProfileData);
}
var getProfileData = function() {
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(firstName + " " + lastName);
});
}
</script>
Then I create an <a>
tag for calling the liLogin
function. 然后我创建一个<a>
标签来调用liLogin
函数。
<a onClick="liLogin()">Linkedin</a>
Uncaught Error: You must specify a valid JavaScript API Domain as part of > this key's configuration. 未捕获的错误:您必须指定有效的JavaScript API域作为>此密钥配置的一部分。 at userspace?v=0.0.2000-RC8.60429- 1429&apiKey=86g3vbk6gy0y56&onLoad=liLogin()&authorize=yes&secure=1&:22 at userspace?v=0.0.2000-RC8.60429- 1429&apiKey=86g3vbk6gy0y56&onLoad=liLogin()&authorize=yes&secure=1&:31 在用户空间?v = 0.0.2000-RC8.60429- 1429&apiKey = 86g3vbk6gy0y56&onLoad = liLogin()&authorize = yes&secure = 1&:22 at userspace?v = 0.0.2000-RC8.60429-1429&apiKey = 86g3vbk6gy0y56&onLoad = liLogin()&authorize = yes&secure = 1:31
Above error occurs when I run the application. 运行应用程序时出现上述错误。
Also, if I write configuration with ""
, then linkedin login page appears, but the content is uh oh
. 另外,如果我用""
编写配置,则会出现linkedin登录页面,但内容是uh oh
。
<script type="text/javascript" src="//platform.linkedin.com/in.js">
'api_key': '86g3tbk6gy0y56',
'onLoad': 'liLogin()',
'authorize': 'yes'
</script>
How can I make linkedin configuration? 如何进行配置?
For some reason LinkedIn does not recognize "localhost" as a valid redirect URI. 出于某种原因,LinkedIn不会将“localhost”识别为有效的重定向URI。 So I suggest you use the actual domain name when you test your website in dev environment. 因此,我建议您在开发环境中测试网站时使用实际的域名。 Just add the following line to your host file: 只需将以下行添加到主机文件中:
127.0.0.1 YOUR SITE DOMAIN
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.