I had implemented facebook login in my project using javascript code. It was working fine, but now it is not working.The login popup was also not working.
code is here
<fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>
i changed perms to scope.the popup came but the script problem is still there.
script code used:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'APPID', status: true, cookie: true, xfbml: true});
/* All the events registered */
FB.Event.subscribe('auth.login', function(response) {
// do something with response
login();
});
FB.Event.subscribe('auth.logout', function(response) {
// do something with response
logout();
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
login();
}
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
function login(){
FB.api('/me', function(response) {
fqlQuery();//fqlquery function
});
}
function logout(){
document.getElementById('login').style.display = "none";
}
function fqlQuery(){
FB.api('/me', function(response) {
var query = FB.Data.query('select name, hometown_location, sex, pic_square from user where uid={0}', response.id);
query.wait(function(rows) {
document.getElementById('name').innerHTML =
'Your name: ' + rows[0].name + "<br />" +
'<img src="' + rows[0].pic_square + '" alt="" />' + "<br />";
});
});
}
is there any other way to correct the problem?? please help….
I think you’re missing the APP ID from the querystring when loading the facebook javascript SDK. Per https://developers.facebook.com/docs/reference/plugins/login/ they want it there for some reason
Also I noted that your login button HTML doesn’t have correct attributes. Per the documentation,
show-faces,width,max-rows, andscopeare the only valid parameters.