Infinite loop during Facebook Authorization

smeathe

New Member
I have this simple code:\[code\]// index.phprequire_once("/fb/facebook.php");require_once("/config/config.php");$facebook = new Facebook(array( 'appId' => $config['appId'], 'secret' => $config['secret'], 'cookie' => true));$user = $facebook->getUser();if ($user === 0) { $loginUrl = $facebook->getLoginUrl(array( 'redirect_uri' => 'https://www.example.com/join.php' )); echo("<script> top.location.href='" . $loginUrl . "'</script>"); exit;}else { var_dump($facebook->api("/me")); } \[/code\]and the join.php code is:\[code\]//join.phprequire_once("/fb/facebook.php");require_once("/config/config.php");$facebook = new Facebook(array( 'appId' => $config['appId'], 'secret' => $config['secret'], 'cookie' => true));if (isset($_REQUEST['error'])) { echo("<script>top.location.href='". $config['errors']['auth'] . "'</script>"); exit;}echo("<script>top.location.href='". $config['url'] . "'</script>");\[/code\]the problem is that when i go to: http://apps.facebook.com/myappsample (and I'm NOT logged on facebook) the application show the auth dialog (correctly) but after this step it does an infinite loop from index.php to join.php.As you can see when I check if there are any errors in join.php i do a redirect to index.php (the home page of the application) BUT in the index.php I still get \[code\]$user === 0\[/code\] so it redirects another time to join.php....etc etc etc (infinite loop).How can I fix this kind of problem?Thank you very much!EDIT: I use join.php as callback (redirect_uri) for the login page. THe purpose of this page is to save inside a database the informations about the user, so join.php will do it and then redirect to index.php to let user use the application. Wrong?
 
Back
Top