Login with Linkedin Using Javascript
Login with Linkedin Using Javascript
For more information visit:
http://developers.linkedin.com/documents/getting-started-javascript-api
<!--Script for LinkedIn Login add in head -->
<script type="text/javascript" src="https://platform.linkedin.com/in.js">
api_key: 75dtnfjj******
authorize: true
lang: en_US
</script>
<script type="text/javascript">
// JavaScript Document
function signupLinkedIn()
{
IN.User.authorize(onLinkedInAuth);
if(IN.User.isAuthorized())
{
//DO STUFF
//console.log('welcome');
}
return false;
};
function onLinkedInAuth() {
// we pass field selectors as a single parameter (array of strings)
IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "emailAddress"])
.result(function(result) {
setLoginBadge(result.values[0]);
})
.error(function(err) {
alert(err);
});
}
function setLoginBadge(profile) {
if (!profile) {
profHTML = "<p>You are not logged in</p>";
}
else
{
var firstName = profile.firstName;
var LastName = '';
var email = '';
if(profile.lastName)
{
LastName = profile.lastName;
}
if(profile.emailAddress)
{
email = profile.emailAddress;
}
$.ajax({
type: "POST",
url: "/api/social/signup-login",
data: { firstname: firstName, lastname: LastName, email: email,password:'',signupsource:3}
}).done(function( data ) {
//console.log(data);
location = '/admin/index/events';
});
}
}
</script>
<button id="login" onclick="signupLinkedIn()">Login With Linkedin</button>
View More:-
Login With GooglePlus Using Javascript
Login with facebook using Javascript
For more information visit:
http://developers.linkedin.com/documents/getting-started-javascript-api
<!--Script for LinkedIn Login add in head -->
<script type="text/javascript" src="https://platform.linkedin.com/in.js">
api_key: 75dtnfjj******
authorize: true
lang: en_US
</script>
<script type="text/javascript">
// JavaScript Document
function signupLinkedIn()
{
IN.User.authorize(onLinkedInAuth);
if(IN.User.isAuthorized())
{
//DO STUFF
//console.log('welcome');
}
return false;
};
function onLinkedInAuth() {
// we pass field selectors as a single parameter (array of strings)
IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "emailAddress"])
.result(function(result) {
setLoginBadge(result.values[0]);
})
.error(function(err) {
alert(err);
});
}
function setLoginBadge(profile) {
if (!profile) {
profHTML = "<p>You are not logged in</p>";
}
else
{
var firstName = profile.firstName;
var LastName = '';
var email = '';
if(profile.lastName)
{
LastName = profile.lastName;
}
if(profile.emailAddress)
{
email = profile.emailAddress;
}
$.ajax({
type: "POST",
url: "/api/social/signup-login",
data: { firstname: firstName, lastname: LastName, email: email,password:'',signupsource:3}
}).done(function( data ) {
//console.log(data);
location = '/admin/index/events';
});
}
}
</script>
<button id="login" onclick="signupLinkedIn()">Login With Linkedin</button>
View More:-
Login With GooglePlus Using Javascript
Login with facebook using Javascript
Comments
Post a Comment