views:

105

answers:

1

Hi Guys,

I have a ASP.NET web site which uses Facebook Connect for authentication - using the JavaScript API and the Facebook Connect FBML Button.

Here is the regular flow of events for a "Connect with Facebook" button click, when user isnt logged into Facebook.

  1. Dialog is shown requesting user to login
  2. Dialog requests permission from the user for basic info permission
  3. The popup is closed
  4. The callback function i supplied for "onlogin" is fired.

All good.

Now - here's what i think is a bug: the user is already authenticated to Facebook, but has not authorised my app.

This is the flow:

  1. Dialog is shown requesting permission from the user for basic info permission
  2. The URL for the popup changes to http://rootofmysite.com/?installed=1&token=3e3920d309
  3. The user is left wondering what is going on, and the onlogin callback is NOT fired.

So, the popup window is replaced with my original site, and in the querystring is the OAuth token? This looks to be the "Post-Authorise Callback" URL which used to be in the Facebook Application Settings - but has been removed. Anyway, i dont care about this URL - i request permissions/authorization using the client-side JavaScript API, as im a sure a lot of people do.

I understand the user is already authenticated, so they wouldn't need to login again, but what i dont understand is a) why the "onlogin" event handler is not called, and b) why on earth are they replacing THEIR dialog with my site and the OAuth token in the url?

At the moment, i am trying to do a "creative workaround" where i detect this URL and close the popup and call my "onlogin" handler manually (what Facebook SHOULD be doing).

Still, quite dodgy.

EDIT

It's another bug peoples. Please vote for it so they fix it.

+1  A: 

It's a (unconfirmed) bug.

http://bugs.developers.facebook.net/show_bug.cgi?id=12260

Hopefully it gets more votes so it gets fixed - vote people!

In the meantime, i am (attempting) to employ the following 'creative workaround':

  1. Add logic to my Default.aspx page to detect that URL they are redirecting to in the popup.
  2. Redirect to my page, FacebookInboundAuthorization.aspx, preserving querystring.
  3. On load of that page, register some JavaScript to close the popup and manually fire the "onlogin" event handler for my button.

EDIT

To clarify my above, i didnt mean "vote people" as in to vote for my answer here, i meant vote for the bug on Bugzilla (so that FB accept it as an issue and fix it).

RPM1984
I don't think that voting here your question to have the fb guys fixing it is the correct path... But good observation!
Matias
The only other ways to fix it are dirty hacks as RPM1984 has suggested or migrating to the new SDK, which may or may not be an option for developers, depending on the level of complexity of their integration and the resources they have available. I still think it's worth voting up.
BBonifield
@Matias - i raised this question before i knew about the bug. Once i found the bug, i thought it will be worthwhile to posting as an answer, as people can come here and know its a bug, so they dont spend hours to find it (like i did). Plus i am mentioning an alternative (which i am trying to implement, but having problems getting a handle on my onlogin function). Migrating to the new SDK is not a short term possibility. This is a live app which is broken.
RPM1984

related questions