infinite redirects - callback_url

Dec 30, 2007 at 4:04 PM
hi,

I have just got started with facebook api. I created an application in accordance with the steps specified in http://developers.facebook.com/step_by_step.php. In my callback url my code is as follows.

<?php
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 (http://services.tucows.com/developers/2007/07/25/getting-started-with-facebook-application-development/)

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

<?php
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()) {
$facebook->redirect($facebook->getaddurl());
}
} catch (Exception $ex) {
//this will clear cookies for your application and redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($appcallbackurl);
}

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
http://{callbackurl}/?authtoken=(token)&authtoken=(token)&authtoken=(token)&authtoken=(token)&authtoken=(token)

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.

Thanks.
anator
Jan 2, 2008 at 9:42 AM
Edited Jan 2, 2008 at 9:42 AM
anator,

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 http://www.f8dotnet.info/

hth,
T'