Guys,
######### HTML PART #############
<!---fb:login scope="email" >Login with Facebook</fb:login-->
<input type="button" id="login_button_server" onclick="facebookLogin()" value="Facebook Login"/>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '7845787548501',
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('auth.statusChange', function(response) {
//alert(response.status);
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
FB.api('/me', function(response) {
//alert(response);
var email = response.email;
var name = response.name;
var username = response.username;
alert('Good to see you, ' + response.email + '.');
});
}else{
alert("Error found while logged in. Please try again.");
}
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.type = 'text/javascript';
e.src = 'https://connect.facebook.net/en_US/all.js';
document.getElementsByTagName('head')[0].appendChild(e);
}());
function facebookLogin() {
FB.login(function(response) {}, {scope:'email'});
}
</script>
Cheers!
######### HTML PART #############
<!---fb:login scope="email" >Login with Facebook</fb:login-->
<input type="button" id="login_button_server" onclick="facebookLogin()" value="Facebook Login"/>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '7845787548501',
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('auth.statusChange', function(response) {
//alert(response.status);
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
FB.api('/me', function(response) {
//alert(response);
var email = response.email;
var name = response.name;
var username = response.username;
alert('Good to see you, ' + response.email + '.');
});
}else{
alert("Error found while logged in. Please try again.");
}
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.type = 'text/javascript';
e.src = 'https://connect.facebook.net/en_US/all.js';
document.getElementsByTagName('head')[0].appendChild(e);
}());
function facebookLogin() {
FB.login(function(response) {}, {scope:'email'});
}
</script>
Cheers!
ONLY THAT ???????
ReplyDeleteHi Clement,
DeleteYes that's good enough.
If you required further assistance please let me know.
Thanks
Ashwani
Many Thanks..it's very useful..
ReplyDeleteReally awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
ReplyDeletePHP Coders in India