views:

965

answers:

3

I've set up django-facebookconnect on my Django-based site, and it works great — login, posting to the user's News Feed, etc. — except for the fact that login fails in Firefox.

When you click the "Connect with Facebook" button, it pops up the window for the user to type in their Facebook login info like normal, but the original page, instead of sitting still, goes to an error page. And the window that pops up is blank

I've traced the problem to facebookconnect's views.py file. The facebook_login function, specifically. The following two lines of that function, even more specifically:

user = authenticate(request=request)
if user is None or not user.is_active:
    # generate error message and send user to error page

I've checked, and it turns out that in Firefox, user is None. Clearing the browser's sessions/cookies/cache didn't help, and as I said, the problem doesn't occur in other browsers.

Is this a problem any of you have run into before? A vigorous googling hasn't revealed anything. I'd appreciate any guidance you can offer. Thanks.

+2  A: 

Problem solved. For reasons I'm not clear on, moving the facebookconnect JS includes ({% facebook_js %} and {% initialize_facebook_connect %}) to just after the includes for jQuery and my own JS, instead of just before, fixed the problem.

For the record, and so that people might use Google to stumble upon this in the future, the error I'd been getting was "FB.HiddenContainer.get() is null or not an object".

kareem
I was only able to get rid of this error after moving the `{% facebook_js %}` include to appear after the `<body>` tag.
Bryan Veloso
A: 

I had the same thing - driving me mad! Using protoype and scriptaculous from Google's jsapis. Thanks to your post I got it all working by changing my code to:

<script language="JavaScript1.2" type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
<script language="JavaScript1.2" type="text/javascript" >
    //<![CDATA[
        google.load( "prototype",     "1" );
        google.load( "scriptaculous", "1" );
    //]]>
</script>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script language="JavaScript1.2" type="text/javascript">
    //<![CDATA[
        FB_RequireFeatures(['Api', 'Base', 'CanvasUtil', 'Common', 'Connect', 'XdComm', 'XFBML'], function()
....

I hope this helps others as much as your post helped me!

Phil
+1  A: 

In order to get it working in both Firefox and Chrome i had to keep it both in the header (for chrome) and as the last script on the site (for Firefox).

The error i was getting was:FB.HiddenContainer.get().

Although i keep getting it, it works :)

Anders