Try doing:
$returnUrl = $uri->toString(array('path', 'query'));
echo $returnUrl;
exit;That will display what the URL is that JFBConnect 'thinks' it should be redirecting too. See if that seems correct for the page that's being loaded or not.
Also, try setting the $returnUrl to a known-good URL to see if that redirection properly works and it's just the auto-generated one. That will help us narrow things down. To set it, just do:
$returnUrl = 'index.php';
That should be good enough, but you can obviously try any URL.
Let us know how that goes, and good luck.
Thanks,
Alex