facebooker2 + oauth2 migration tips (deadline 10/1)

12 views
Skip to first unread message

klochner

unread,
Sep 27, 2011, 5:30:36 PM9/27/11
to faceb...@googlegroups.com
Just got this working and wanted to post my experience in an obvious place.

If you're using facebooker2 with oauth2 (which you need to be by end of week) and have code like the following:

  FB.getLoginStatus(function(response) {
    if (response.status != "connected")  { //note response.status
      FB.Event.subscribe('auth.login', function(response) {
        <% if !logged_in? %>
           window.location.reload(true);
        <% end %>
      });

Firefox doesn't pick up the cookie state, forcing a 2nd manual reload to log in.  You can fix by changing to this:

   window.setTimeout("window.location.reload(true)",0);

It looks like a bug with the js library, not setting the cookies before the reload call:
http://stackoverflow.com/questions/7553037/facebook-javascript-sdk-window-location-reload-not-working-on-firefox
http://bugs.developers.facebook.net/show_bug.cgi?id=20499

The other gotchas I found in moving to oauth2:
  • use response.status == "connected" instead of response.session
  • change "perms" to "scope" in fb:login-button code
Reply all
Reply to author
Forward
0 new messages