Closed (fixed)
Project:
Drupal for Facebook
Version:
6.x-3.x-dev
Component:
Facebook Connect
Priority:
Major
Category:
Support request
Assigned:
Reporter:
Created:
4 Nov 2010 at 13:16 UTC
Updated:
22 Mar 2012 at 13:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
Dave Cohen commentedThanks for the report. I'm seeing this, too.
Not sure exactly what changed recently but this needs to be fixed.
Comment #2
Dave Cohen commentedLooking into...
Comment #3
Dave Cohen commentedHere's an update that I'm testing. I think it fixes the problem, not sure there are no ill effects...
Comment #4
Juan C commentedThere you are. It fixes the problem (or even seems smoother logins/logouts). Patch #3 applied against latest 6.3.dev.
Cheers.
Comment #5
Dave Cohen commentedAssuming no longer a problem.
Comment #6
robsongmoser commentedHello, I'm getting this issue with 6.x-3.0-rc1.
Comment #7
robsongmoser commentedHello Dave,
Thanks for the great module. I have read the Read Me to the end and think I have everything set up properly. I am getting this exact issue with 6.x-3.0-rc1. I can login to fb and it works but my page doesn't refresh automatically.
Comment #8
Dave Cohen commentedCan anyone reproduce on http://www.drupalforfacebook.org? If so, what browser?
Comment #9
robsongmoser commentedHi Dave,
http://www.drupalforfacebook.org works fine for me with latest version of Firefox on latest OSX. I must have some glitch in my Drupal set up.
Are there any diagnostics I could try?
Comment #10
Dave Cohen commentedUse firebug or something like it to look for javascript errors.
Comment #11
robsongmoser commentedHi Dave,
I tried logging in to my site using Safari and the refresh worked. Then I tried logging in from Firefox, my usual browser, and it works, maybe a little slowly, but it does refresh by its self. Maybe I was just being impatient? Anyway, its working now.
Comment #12
Dave Cohen commentedcool. sounds fixed.
By default what happens is 1) user connects, 2) javascript makes ajax call to Drupal server, 3) javascript reloads page. It would be nice to signal to the user they should wait, but I'm not sure how to pop up a wait icon.
Comment #13
groovehunter commentedi wonder if this is related or same as my current prob; I click on login button and my custom access-denied-page is shown again; after a while a request is done and i get the page as logged in; And again after some seconds another request which results again in access-denied.
btw it's the same on http://www.drupalforfacebook.org
Comment #14
Dave Cohen commentedSorry I'm not understanding. How do you make the access denied page appear on drupalforfacebook.org?
Comment #15
gallamine commentedI have this issue too. I actually just posted some JS errors I was getting into this issue queue #681876: refresh after login
Comment #16
maestrojed commentedI am also having this problem.
Plus, if you have role specific content you need the page to reload after a successful login.
Comment #17
groovehunter commented@Dave , to be more exact, i checked with firebug:
( i am logged into FB )
1. I open dffb homepage :
it loads dffb files, then from facebook.org: all.js is fine
but then loginstatus.php:
HTTP error 302 Moved Temporarily:
Same on my two sites.
Not sure if this fits into this issue queue... I use dev version from 11-24
thx a lot much for support and your good work on the module.
florian
Comment #18
Dave Cohen commentedSounds like a problem on facebook's end.
Comment #19
maestrojed commentedIn Summary the issue is that after a successful authentication from Facebook the drupal page and the Facebook Connect button do not reload or change to represent that the user is logged in. If you refresh the drupal page this change is reflected. The page should refresh on its own. Or at least be an option.
This issue seems to arise when you use the "User Management" portion of the module and allow form alters.
If you use the Facebook Connect login Block it seems to work a little better. I got mixed results of it changing the button after login. Regardless it still does not reload the page.
Reloading the page is important because many drupal sites and pages will have different content or functionality based on a user's role. For instance on my site the main functionality is adding content. However only authenticated users can add content or see the add content form. If the page does not reload the Facebook authenticated user never sees the "add content" forms.
The patch above may be for a different version. The patch does not apply and a manual inspection of the patch reveals that the current 6.x-3.0-rc1 is different then expected. I imagine that patch is no longer useful which is why the status was changed to active and not needs work.
Comment #20
Dave Cohen commentedIn my tests, both on my dev env and drupalforfacebook.org, the pages reload just as they are supposed to.
Comment #17 makes me think there was a temporary problem on facebook.
Not much I can do unless someone provides details how to reproduce this.
Comment #21
maestrojed commentedYou are correct. I created a simple install and it worked great. I guess my issues is a conflict with another module or something on my site. Sucks. Any debug suggestions? I ran a javascript profile and I didn't see any errors. There was a bunch of stuff.
Should I change the status of this issue to closed(cannot reproduce)?
Comment #22
Dave Cohen commentedMarking as fixed (which it was before #19).
If you figure it out, please let us know what causes this.
Comment #24
US Drupal Development commentedYeah, I'm seeing the same thing. Fresh install of rc7. User connects, and then the site just hangs.. no refresh at all. Have to 'hard refresh' to see the Fb info pop up. This also therefore breaks any custom redirects. Switched to Garland theme and see the same issue.
Comment #25
orangeudav commentedI have same problem as #24 after logout and relogin with fConnect button in the login block. Page is not refreshed.
I am created hook_fb($op, $data, &$return) and logging $op and $data, i see nothing event after relogin.
Chrome (and Chromium), "Set FB Cookie" enabled
Comment #26
Dave Cohen commentedDo you guys see any errors in firebug or chrome console when reproducing this?
Comment #27
orangeudav commentedChromium
while open facebook auth dialog this error was 134 times:
(134) Unsafe JavaScript attempt to access frame with URL https://www.facebook.com/login.php?api_key=190101651017102&skip_api_logi... from frame with URL http://xxxxxxxx.ru/. Domains, protocols and ports must match.
after close facebook auth no redirect and this error 2 times:
(2) Unsafe JavaScript attempt to access frame with URL http://static.ak.fbcdn.net/connect/xd_proxy.php#cb=f19f8f3934&origin=htt... from frame with URL http://xxxxxxxx.ru/. Domains, protocols and ports must match.
after click fConnect button again i see "An error occured" in fb auth window and after close:
(2) Unsafe JavaScript attempt to access frame with URL http://static.ak.fbcdn.net/connect/xd_proxy.php#cb=f3375d0db8&origin=htt... from frame with URL http://xxxxxxxx.ru/. Domains, protocols and ports must match.
Comment #28
US Drupal Development commentedI'm seeing this as well... /fb/ajax/session_change 302 Moved Temporarily
No refresh, nothing. Have to hard refresh to login, which makes the site very unusable.
I've tried rc7, 6, 5...
Comment #29
US Drupal Development commentedIf I hit the post authorize link directly:
....com/fb_app/event/[app_name]/post_authorize/
I get:
Fatal error: Call to undefined function fb_connect_init_js() in /....httpdocs/sites/all/modules/fb/contrib/fb_permission.module on line 245
Is this why it doesn't refresh?
Comment #30
US Drupal Development commentedBumping this up after more investigating...
This is now taking place on 12 websites where we use this module. It is:
* Independent, we think, of the version of Drupal for Facebook (we tried rc1, rc7, rc6, rc5, at least)
* Independent of the theme used (that is, we switched back to stock Garland, making sure to add in the FBML)
* Independent of the Drupal version (that is, we tried 6.20, 6.19, 6.18)
* Independent of the couple version of jQuery we tried (that is, we tried stock jQuery and jquery-update 2.0-alpha)
* Independent of the browser we tested (it broke in Safari, Firefox, and Chrome)
* Independent, we think, of the Fb user itself (that is, it affected all users that we tested)
It seems as though Drupal for Facebook is never "receiving" the page redirect, and thus not acting on it. The result is that the user thinks he or she is not logged in, and has to do a hard refresh. This also means if you're intending for a user to go to a new destination after login, you're out of luck.
Comment #31
US Drupal Development commentedi should have also noted...
This wasn't just an issue where we upgraded to rc7. We have older sites that stayed on rc1 that worked perfectly - and are now not working. This would seem to point to, perhaps, a change on Facebook's side that the module isn't able to handle or account for? Shot in the dark...
Comment #32
Dave Cohen commentedI'm puzzled by this. I was able to reproduce just now on one of my devel sites. And I see some page not found errors in my log. looking into it.
Comment #33
US Drupal Development commentedThanks Dave! Let us know if we can help. We've had some developers look into it but we just can't seem to trace it down. It seems like Facebook is sending back the redirect URL, but there's nothing there server-side to receive that message and act on it.
Comment #34
Dave Cohen commentedThere are two ways to setup a facebook connect site...
The simplest is to have just one facebook application. On Drupal, check the "primary" checkbox. And this ensures that facebook API (javascript and PHP) are initialized on every page.
The second is to not check the primary checkbox, but instead enable the facebook block. This way, facebook's api will initialize only on pages with the block. This allows a site to have two (or more) different apps for facebook connect.
The second way is trickier. I was able to reproduce this problem using the second approach, but not the first.
So I ask the people on this thread, which technique are you using? If you have the primary checkbox enabled and still have this problem, please go to your remote app settings, click the advanced tab and list here which "migrations" you have enabled.
Comment #35
Dave Cohen commentedAlso, do you have other fb modules enabled like fbconnect or fb_social? Anything non modules/fb that might initialize facebook's javascript?
Comment #36
Dave Cohen commented#1034222: load facebook javascript asynchronously patch #3 might solve this problem. I can't reproduce it except in the case I described (#34), so I'm not sure.
If anyone is able to test that, please let me know what happens.
Comment #37
US Drupal Development commentedWe only use your module - no other modules. We also were able to reproduce this with stock Drupal --- no other modules installed.
Comment #38
US Drupal Development commentedAnd I will test that patch now.
Comment #39
US Drupal Development commentedI upgraded to -dev and then applied the patch. Notta. A hard refresh is still required to be logged in.
What's strange is that if I head to /logout, it does the proper redirect to also log me out of Facebook, then hits my front_page, and then CORRECTLY refreshes. I see the ?_fb_js_fbu=494294092142 change to ?_fb_js_fbu=0.
So it seems like logging out refreshes properly... but logging in does not.
Comment #40
US Drupal Development commentedAnd I'm still seeing...
Fatal error: Call to undefined function fb_connect_init_js() in /var/..../sites/all/modules/fb/contrib/fb_permission.module on line 245
When I visit...
http:/....fb_app/event/app_name/post_authorize/
Looks like fb_connect_init_js() is actually a private function in fb_connect. Who knows if that's related.. just noticing it.
Comment #41
Dave Cohen commentedHmmm... that fb_permission problem, I guess I overlooked it when you first mentioned it. While I don't think that is the problem, might be worth disabling that module and seeing if the problem goes away.
I think the entire fb_permssion_fb() function is no longer needed.
Comment #42
US Drupal Development commentedWhile that did resolve the error, it didn't fix the problem. But I did some more digging... I firebug'd logging out and back in.
I notice two strange things:
A POST to /fb/ajax/session_change that resolves in a 302 Temporarily Moved warning.
A GET to the correct redirect address, which does load 200 OK, but of course I never get there (unless I hard refresh)!
It's like it's only a step away from working... but we don't quite get there.
Comment #43
Dave Cohen commentedMaybe something is calling drupal_goto() from within the fb/ajax callback.
Try adding something like this to the top of drupal_goto()...
Then, reproduce the error. Look in the log for that message, when /fb/ajax/session_change was called. Post the stack trace here.
Comment #44
Dave Cohen commentedOh, and if you have global redirect enabled, try disabling it.
Comment #45
US Drupal Development commentedFinally, some progress. The backtrace revealed we still had a _user hook floating around somewhere in a module. When we removed this hook, bam. Refresh. We are investigating other websites to see if that is the commonality. (Though, we WERE able to replicate this issue with a stock D6 install.) What is the "correct" way to set a custom redirect after fb logs in?
Comment #46
US Drupal Development commentedA thought... Is it possible this issue originated from a conflict (a user hook, or in other people's examples, global_redirect) -- but then extended to other sites because of some... SESSION variable or something? Just another shot in the dark.
Comment #47
Dave Cohen commentedhttp://drupal.org/node/969242
The way it works is, javascript detects the session change, then posts AJAX request to drupal, basically asking "what should I do now?". When the ajax returns, fb.js will reload the page, unless the ajax returned some other instruction. If instead of returning the ajax fails or redirects or what have you... no redirect. The goal is support advanced cases where instead of redirecting, just a portion of the page is updated, as well as the blunter instrument which is refreshing the entire page.
If you can reproduce with stock D6, let me know. Otherwise, OK to mark this as fixed again?
Comment #48
rmarino commentedSorry to reopen this, but I have this same problem and as much as I read all the thread still cannot make it work. Don't know how it is fixed.
I need to hit the refresh button to see the username.
I also tried to create a rule, when users login with facebook then redirect but it doesn't fire.
@US Drupal Devel said "The backtrace revealed we still had a _user hook floating around somewhere in a module. When we removed this hook, bam", does this mean I can't use hook_user() at all for this to work? I have to use it.
My site is on development ( a bit messy at this point) but you can check if you want: http://nytlights.vl64.dinaserver.com . As you can see, when you connect, until you refresh the browser, username doesn't change.
I'm using last 6.x-3.x-dev (25 jan), there is just 1 app and primary is checked. Deactivated global redirect.
Comment #49
Dave Cohen commenteddo you see any errors in either firebug or your server log?
Comment #50
rmarino commentedNo errors.
Well, what I did now is to change the Post-Authorise Callback URL to: http://nylights.com/user
Firebug shows me:
POST http://nytlights.com/fb/ajax/session/change and the response is the http://nylights.com/user html.
After that:
Cookie changed SESSxxxx
GET http://nytlights.com/user -> this one doesn't have response
But the page doesn't change at all.
Any ideas?
Thanks
Comment #51
Dave Cohen commentedFirst, change the post authorize callback back to what it was.
If you have a hook_user() that is calling drupal_goto() or anything calling drupal_goto() during the ajax callback, then you have the same problem as the earlier poster. Try putting a breakpoint in fb.js around line 201 (the jQuery.post callback). See if that breakpoint is ever reached.
Comment #52
rrrob commentedI'm having the same issue. I set breakpoints on line 195 if (Drupal.settings.fb.controls)... and on line 202 if (js_array.length > 0) {... and line 195 is hit, but not 202.
It is on the homepage of http://www.teamelites.com/ if you are interested.
This has got to be something that Facebook changed on their end. FB connect was working just fine a few weeks ago when I last tested, and I haven't changed anything on the site.
Comment #53
Dave Cohen commenteddeckerdev, that makes it sound like the ajax call to drupal is being made, but not returning successfully. Any errors in the drupal log?
Anyone out there with jquery chops? How can I call FB_JS.reload() when the jquery.post() fails?
Comment #54
rrrob commentedUnfortunately, I'm not seeing any errors in the Drupal log.
As for jQuery.post(), you may want to look at jQuery.ajax() instead. It provides an error handler that the shorthand jQuery.post() does not. See http://api.jquery.com/jQuery.ajax/
Comment #55
rrrob commentedSomething like this should work:
Comment #56
rrrob commentedThe code that I just posted will perform the page reload, but it won't use the
Drupal.settings.fb.reload_urlthat is passed in the FB Connect button:<a onclick="Drupal.settings.fb.reload_url='http://www.mysite.com/redirect-to-me';FB.login(function(response) {}, {perms:Drupal.settings.fb.perms}); return false;" class="fbconnect" href="#">Login</a>When I put a breakpoint in the
successcallback function, thejs_arrayvariable is empty.Comment #57
Dave Cohen commentedI'm interested to hear what is passed into that error function. That should be a clue as to why there is a problem in the first place.
Comment #58
funkym commentedI'm getting a similar bug with 6.x-3.0-rc13.
If the Firebug console is open I see the following error:
resolveRelation(params.relation) is null
resolveRelation(params.relation).postMessage(fragment, params.origin); Line 93
Comment #59
wanderingstan commentedI'm getting this same error.
Chrome reports as what seems to be an xss javascript error, or a problem with accessing an HTTPS url:
A similar problem occurs when attempting to log out.
Uncaught TypeError: Object #<Object> has no method 'getSession'Comment #60
elioshCan confirm error in #59 with version 6.x-3.2-rc3
Comment #61
Dave Cohen commentedSame as what? Don't completely change an ancient thread. Marking fixed (cause I think the original issue is)
Comment #62
shaneonabike commentedI can confirm this is working (wasn't before) on our development site with the latest dev version.
@Dave Cohen: I changed the version to dev since it wasn't working in RC3 but rather dev (I hope that's ok).
Just wondering if you could release another version RC4 or an official release since not having this work pretty much makes it hard for users to know that the module is functioning :/
Any way just my $0.02. Thanks for a great module with lots of features and API's!