Take the 2-minute tour ×

I'm using the following code:

    alert('Inside login status');
    FB.getLoginStatus(function (response) {
            if (response.status === 'connected') {
                //user is logged in and connected
                userid = response.authResponse.userID;
                accesstoken = response.authResponse.accessToken;
                alert('Welcome' + response.authResponse.name);
                //return 'connected'
                //do something with user
            else if (response.status === 'not_authorized') {
                //user is logged into facebook but not connected to the app
                //do something
                alert('Like us to get started');
                //return 'not_authorized'
            else {
                //the user even connected to facebook
                //button.innerHTML = 'unknown'
                //button.onclick = function () { login(); }
                alert('login to get started');
                //return 'unknown'

I have defined the above code in a function that is called in the async init. (The async init is defined in the code behind, I'm registering the script to the head of the page on page load) The first alert is called which means I get into the function, but the rest of it doesn't seem to work. No alerts are displayed after that.

On debugging using breakpoints, I was just directed to the end of the function. No clue why this happens. Am I missing something?

share|improve this question
None of the events that I've subscribed to run. login or logout, nothing seems to get inside the method and display an alert. –  Kunal Jan 17 '12 at 13:25
add comment

2 Answers

Make sure that you have specified correct callback URL in facebook application setting. And If you are testing it on local machine, have you created virtual directory?

share|improve this answer
add comment

It's just the way it runs on my system. I deployed it to a different environment and it worked like a charm.

share|improve this answer
add comment

Your Answer


