在我的应用程序中,我使用了linkedIn API 登录。如果用户已经在同一个浏览器中的linkedIn中登录并在我的网站中按下linkedin登录按钮,用户将自动登录到我的网站。但我想问一下linkedIn提供的“允许访问”弹出身份验证窗口。
编辑: 使用 Samer Bechara 回答
$(document).ajaxSend(function(event, jqxhr, settings) {
if ( settings.url == "https://www.linkedin.com/uas/oauth/authenticate" ) {
settings.url = "https://www.linkedin.com/uas/oauth/authorize"
}
});
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: apikey goes here
onLoad: onLinkedInLoad
authorize: false
</script>
<script type="text/javascript">
function onLinkedInLoad() {
IN.ENV.js.scope = new Array();
IN.ENV.js.scope[0] = "r_emailaddress";
IN.ENV.js.scope[1] = "r_contactinfo";
//IN.User.authorize();
IN.Event.on(IN, "auth", onLinkedInAuth);
}
function onLinkedInAuth() {
IN.API.Profile("me").fields("id,firstName,lastName,headline,emailAddress,mainAddress,phoneNumbers").result(displayProfiles);
}
function displayProfiles(profiles) {
member = profiles.values[0];
var phs="";
var mid =member.id;
var eid= member.emailAddress;
var mad= member.mainAddress;
var ln= member.lastName;
var fn= member.firstName;
var json = JSON.stringify(profiles);
var ph=member.phoneNumbers._total;
if(ph >0){
phs=member.phoneNumbers.values[0].phoneNumber;
}
}
</script>