infinite redirects - callback_url

Dec 30, 2007 at 4:04 PM

I have just got started with facebook api. I created an application in accordance with the steps specified in In my callback url my code is as follows.

require_once 'appinclude.php';
echo "<p>hello $user</p>";

When I call my callback url directly from the browser. I am first authenticated and then both the facebook server and my web-host server go on an infinite tailspin (they keep redirecting to each other). In tutorials in tucows accessing the callback_url from browser works (

The code in appinclude.php (included above in callback url (index.php)) is

require_once 'facebook.php';

$appapikey = 'my app key';
$appsecret = 'my secret'
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login(); //this works fine

$appcallbackurl = 'my callback url';

//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
if (!$facebook->apiclient->usersisAppAdded()) {
} catch (Exception $ex) {
//this will clear cookies for your application and redirect them to a login prompt
$facebook->set_user(null, null);

I believe the highlighted code is creating the problem. My canvas url works alright and renders the page properly. I also noted that the url during continues redirecting is of the form

Yes a total of 5 authtokens is in the url while I read in the facebook docs that there should be only one authtoken. I am still very new to this and find it difficult to grasp the mechanism behind the whole thing.
I am unable to figure out the problem. Please help me.

Jan 2, 2008 at 9:42 AM
Edited Jan 2, 2008 at 9:42 AM

The Facebook Developer Toolkit is made to develop Facebook apps on the windows platform. If you are using PHP you can find some help on the Facebook Dev. Forum.
If you are using C#, you can find an adapted tutorial for a Hello World-FBML application on