0
votes

Our Asp.net site has been using the facebook login button (w/ javascript sdk) to handle the login process, and now that Oauth is mandatory (as of Dec 15, 2011 (yesterday))- it is broken. I've made some obvious changes that were mentioned the fb oauth migration blog, but still I'm getting errors. Specifically, when FB.init()'s parameter sets status=false, the auth.login event is never fired (which is a problem, because I use callback on that event to invoke another page which does some server-side open graph queries based on the authorization token in the resulting cookie). If I set status=true, then the event is fired, but the cookie is not set, and so I'm unable to make my server-side open graph queries.

Here's my javascript code (slightly edited...):

  window.fbAsyncInit = function () {
        FB.init({
            appId: GetFacebookAppId(),
            status: true, 
            cookie: true,
            xfbml: true,
            oauth: true
        });

        FB.Event.subscribe('auth.login', function (response) {
            if (response.authResponse && response.authResponse.accessToken)
                FacebookLoginRedirect(); 
        });
   }

Any ideas?

Thanks!

3

3 Answers

0
votes

Try FB.getLoginStatus() instead of if (response.authResponse && response.authResponse.accessToken)

See detaild example here in the docs : ]

0
votes

Hopefully someone finds this useful- I was able to listen to a different event: auth.statusChange, check the response, and then proceed. One thing was that I had to unsubscribe to this event once I had successfully logged in, but then it seemed to work ok.

0
votes

listen to auth.statusChange :

FB.Event.subscribe('auth.statusChange', handleStatusChange);