I have a difficult problem. Difficult means I searched through the network and StackOverflow, as well as all the documentation of the FBJS SDK and could not find the answer.
I am creating a Tab page application where I would like to allow fans to participate in rsvp events. So I have to check if the user is logged in, and if not, I need to log in. It sounds pretty simple, but FB.getLoginStatus does not perform a callback function. This is a code excerpt:
FB.init({ appId: window.appID, status: true, xfbml: true, cookie: true, oauth: true, channelUrl: 'http://example.com/fb/channel.html' });
and then I just - of course, after the user clicks the button - call FB.getLoginStatus, but it doesn't seem to do anything.
I already checked the sandbox mode, the success of FB.init, the URLs in the application settings and development environment. I can call FB.ui, although FB.ui with the method: "oauth" I get an error: "The parameter" redirect_uri "cannot be used in conjunction with the" next "parameter, which is deprecated.". This is very strange because I did not use the "Next" option. But when I install next to undefined, it works fine, I get a window, but it says: "This URL is not allowed by the application configuration." Expect me to be able to login, then I have access_token. But in the new window, getLoginStatus still does nothing.
Therefore, any advice is welcome.
Thanks Tamas
UPDATE :
function onBodyLoad() { //on body onload FB.init({ appId: window.appID, status: true, xfbml: true, cookie: true, oauth: true, channelUrl: 'http://example.com/fb/channel.html' }); } ... function getName() { // on button onclick FB.getLoginStatus(function(response){ if (response.authResponse) { window.loggedIn = true; debugString('Logged in'); } else { window.loggedIn=false; debugString('Not logged in'); } }, true); if (window.loggedIn === undefined) { debugString('getLoginStatus did not exec'); // I always get this message }
}
UPDATE 2 . I created a new application on a different url that is configured as a standalone website. There these codes work fine, I can getLoginStatus, I can log in, etc. Is there any difference working in the context of the FB and on a separate website using the FB JavaScript SDK?