linkedin身份验证在服务器上不起作用 [英] linkedin authentication is not working on server

查看:71
本文介绍了linkedin身份验证在服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网络应用程序上集成了身份验证。当我在服务器上部署它时,它无法正常工作。

< script type =text / javascriptsrc =http:// platform .linkedin.com / in.js>

api_key:XXXXXXX

授权:true

onLoad:onLinkedInLoad

范围:r_emailaddress

< / script>

< script type =text / javascript>

函数onLinkedInLoad() {



IN.Event.on(IN,auth,onLinkedInAuth);



}

//在linkedin按钮的onclick事件中使用

函数lnkTest(){

IN.User.authorize(function(){

回调();

});

}





< /脚本>

i have integrated linkedin authentication on my web application.it's not working when i have deploy it on server.
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key:XXXXXXX
authorize: true
onLoad: onLinkedInLoad
scope: r_emailaddress
</script>
<script type="text/javascript">
function onLinkedInLoad() {

IN.Event.on(IN, "auth", onLinkedInAuth);

}
//use in onclick event of linkedin button
function lnkTest() {
IN.User.authorize(function () {
callback();
});
}


</script>

推荐答案

猜测,你有一些看起来像这样的东西:

At a guess, you have something that looks like this:
<button onclick="lnkTest()">Sign In</button>



单击按钮时,将启动异步AJAX请求。但是,您忘记取消按钮单击,因此表单将回发到服务器,这将取消AJAX请求。



取消点击事件,一切都应该work:


When you click on the button, you initiate an asynchronous AJAX request. However, you forgot to cancel the button click, so the form is posted back to the server, which cancels the AJAX request.

Cancel the click event, and everything should work:

<button onclick="lnkTest();return false;">Sign In</button>


< script type =text / javascriptsrc =http://platform.linkedin.com/in.js>

api_key:xxxxxxxx

授权: true

onLoad:onLinkedInLoad

范围:r_emailaddress

< / script>



< script type =text / javascript>

function onLinkedInLoad(){



IN.Event.on(IN,auth,onLinkedInAuth);



}

函数onLinkedInAuth(){

IN.API.Profile(我)

.fields(firstName, lastName,industry,location :( name),picture-url,headline,summary,num-connections,public-profile-url,distance,positions ,电子邮件地址,教育,出生日期)

.result(displayProfiles)

.error(displayProfilesErrors);

}



function displayProfiles(profiles){
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key:xxxxxxxx
authorize: true
onLoad: onLinkedInLoad
scope: r_emailaddress
</script>

<script type="text/javascript">
function onLinkedInLoad() {

IN.Event.on(IN, "auth", onLinkedInAuth);

}
function onLinkedInAuth() {
IN.API.Profile("me")
.fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary", "num-connections", "public-profile-url", "distance", "positions", "email-address", "educations", "date-of-birth")
.result(displayProfiles)
.error(displayProfilesErrors);
}

function displayProfiles(profiles) {


(。abc)。fadeIn ();

member = profiles.values [0];

// alert(JSON.stringify(member));

//调试器;

// alert(JSON.stringify(member));

var email = member.emailAddress;

var name = member。 firstName + + member.lastName; // +
位置是+ member.location.name;

var location = member.location.name;

var company = member.positions.values [0] .company.name;

var joinDate = member.positions.values [0] .startDate.year;

validateSocial(电子邮件,姓名,地点,公司,加入日期);



}

// ==== ======在回调开始时链接===========

函数lnkTest(){

alert(Hi);

IN.User.authorize(function(){

alert(Bye);

callback();

});

}



// ==========在回调结束时链接==== =======

函数displayProfilesErrors(错误){

profilesDiv = document.getElementById(profiles);

profilesDiv。 innerHTML = error.message;

console.log(错误);

}



函数validateSocial(电子邮件,名字,升ocation,company,joinDate){

PageMethods.RegisterUser(电子邮件,姓名,地点,公司,joinDate,OnSuccess);

}

功能OnSuccess(response,userContext,methodName){

window.location.href =my-dashboard;

}



< / script>



它在本地解决方案中工作正常,但没有在server.i猜测脚本源上工作

< ; script src =http://platform.linkedin.com/in.js>未在服务器上加载。提前谢谢。< / script>
(".abc").fadeIn();
member = profiles.values[0];
// alert(JSON.stringify(member));
// debugger;
// alert(JSON.stringify(member));
var email = member.emailAddress;
var name = member.firstName + " " + member.lastName; // + "
Location is " + member.location.name;
var location = member.location.name;
var company = member.positions.values[0].company.name;
var joinDate = member.positions.values[0].startDate.year;
validateSocial(email, name, location, company,joinDate);

}
// ========== linked in callback start ===========
function lnkTest() {
alert("Hi");
IN.User.authorize(function () {
alert("Bye");
callback();
});
}

// ========== linked in callback end ===========
function displayProfilesErrors(error) {
profilesDiv = document.getElementById("profiles");
profilesDiv.innerHTML = error.message;
console.log(error);
}

function validateSocial(email, name, location, company, joinDate) {
PageMethods.RegisterUser(email, name,location,company,joinDate, OnSuccess);
}
function OnSuccess(response, userContext, methodName) {
window.location.href = "my-dashboard";
}

</script>

its working fine in local solution but not working on server.i guess script source
<script src="http://platform.linkedin.com/in.js"> is not loading on server.Thanks in advance.</script>


这篇关于linkedin身份验证在服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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