Facebook App’s Infinite Redirection Solution

facebook Yesterday someone mailed me that my application http://apps.facebook.com/thinkdiffdemo is continuously refreshing. I developed that application 1 year ago for demo purpose. So today I checked and I found yeah its refreshing continuously.

Then I changed the application setting like below and thus the problem solved. So if you also faced this type of problem first check the application setting.

Additionally please update and use the latest php-sdk provided by facebook. Some developers also informed me that it solved their problem.

About mahmud ahsan

Founder And Lead Programmer at iThinkdiff.net

, ,

56 Responses to Facebook App’s Infinite Redirection Solution

  1. Elmer April 15, 2011 at 8:40 pm #

    I have an application based on your demo, it was working all right until yesterday, it begins to do that loop :(
    My migrations setting looks different than this you show in this post:

    I enable “upgrade to Request 2.0″ but it is still in the infinite loop.

    In this web http://www.foobots.net/breakouts.html talks about this problem but their metod is quite different.

    It seem to be happening to many people, what we can do ??

  2. Elmer April 15, 2011 at 8:41 pm #

    This is my migration settings: http://www.elmerticas.com/settings.jpg

    • mahmud ahsan April 15, 2011 at 8:47 pm #

      This infinite loop is really a problem, I never faced it but yesterday I found its in my old application and today I fixed it by changing the setting that I published in this post. But normally whatever I think is that, if you call any graph api that require extended permission then provide the permission in the login tag. Otherwise facebook will redirect.

    • Richard Cantwell April 18, 2011 at 5:49 pm #

      Mahmud – you are a legend! – thank you for this all these really great tutorials and all the developer comments!

      I have a general question about your solution – i’ve just looked in my facebook.com/developers application settings – i don’t see ALL the options you’re seeing in your screen shot? – is there another screen i’m missing? – my settings look like Elmers settings at http://www.elmerticas.com/settings.jpg?

      • mahmud ahsan April 18, 2011 at 8:02 pm #

        Hi Richard,
        My application is created 1 year ago, so I get some more settings. Your one is newer compare to mine that’s why you’re seeing less settings.

  3. Julian Mesa April 15, 2011 at 9:21 pm #

    Thank you! :D

  4. Elmer April 15, 2011 at 9:53 pm #

    Thank you Mahmud, I finally stopped this loop, the solution was actually easy, I just download the last version of PHP SDK and thats all :)

    • mahmud ahsan April 15, 2011 at 10:02 pm #

      Yeah, latest SDK is very important. I am also using the latest sdk.

    • nakres April 16, 2011 at 10:27 am #

      hi, where would i copy PHP SDK from?

      Thank you

      • nakres April 16, 2011 at 10:33 am #

        I am sorry,
        i found it updated and did the changed as you described
        it works very nice again
        Thank you very much

      • nilesh026 August 20, 2012 at 11:52 am #

        put in to your main folder with index file

  5. mommaroodles April 16, 2011 at 9:53 am #

    Mahmud, you are the greatest – thank you so much for the wonderful tutorials – I’ve after a few hrs have managed to setup something basic and its looking good – still work in progress but as soon as I have something more concrete will invite you to have a look :)) thanks once again

  6. bimbolera April 16, 2011 at 4:08 pm #

    i hope facebook will announce these kind of revisions. developers are clueless when their working applications suddenly became buggy.

  7. Hoan Huynh April 17, 2011 at 10:26 am #

    I have the same issue, will try with your suggestion. Thank you.

  8. Arjun Upadhyay April 17, 2011 at 11:08 am #

    Your blog can be coverted a very nice book on “Facebook Apps using Graph Api”.

    I have learnt a lot from your blog.

    Thanks for sharing your knowledge.

  9. Shaughn April 18, 2011 at 5:21 pm #

    Hi mahmud ahsan

    Thanks for this, you solved me hours of searching. Simply updating the SKD worked 100%…..

    But what i dont understand is why this happened in the first place. And this has happened before…

  10. Kenrick Vaz April 18, 2011 at 6:29 pm #

    Hi!
    Thanks alot for this post and all the comments. Helped us tremendously.

  11. nakres April 18, 2011 at 7:11 pm #

    I am sorry i know this does not belong here but is it possible to make a tutorial how to save application users’ information on a database

    thank you

  12. jeffery April 19, 2011 at 12:21 pm #

    Hi mahmud ahsan

    Thanks for this, you solved me hours of searching. Simply updating the SKD worked 100%…..

    But what i dont understand is why this happened in the first place……

    Any your wonderful tutorials has been a real guide for our application developement………….

    Once again thankz very much……….

  13. Hasnain April 19, 2011 at 5:54 pm #

    Thanks Mahmud it solved my problem only by updating the SDK.

  14. miraclemaker April 21, 2011 at 12:25 am #

    Fantastic post thanks!

  15. croatia April 21, 2011 at 3:47 am #

    Hi,

    with new migration settings, returned session array does not contain $session['session_key'] any more. (This can be striped from $session['access_token'])

    Bigger problem is that when user log out from facebook, application is still available with direct access http://apps.facebook.com/appName/ It seems like session remain live.. With previous settings this wasn’t possible..
    Any ideas?

  16. croatia April 24, 2011 at 3:48 am #

    Solution is to sett cookie to false:

    // Create our Application instance.
    $facebook = new Facebook(array(
    ‘appId’ => $fbconfig['appid'],
    ‘secret’ => $fbconfig['secret'],
    ‘cookie’ => false,
    ));

  17. Frank April 26, 2011 at 10:47 pm #

    Hello!

    I am the infinite loop error, my $session always returns an empty string. I have set all of the setting in my application to make the screenshot. I updated the Facebook lib to the 3/22/11 version. And I have tried disabling cookies when initialize the Facebook object.

    Anything else to try?

  18. Vibol April 27, 2011 at 2:59 pm #

    http://bugs.developers.facebook.net/show_bug.cgi?id=15933

    hope they will revise it soon…

  19. ali May 3, 2011 at 6:42 pm #

    thanks for all the great facebook tutorials, so much easier to understand compared to facebooks own documentation.

    Will you be doing a tutorial on implementing facebook credits in an iframe app any time soon?

  20. adeee May 3, 2011 at 11:00 pm #

    hello brother. i try to use ur facebook application demo http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/

    but when i try to make my own. i got the redirect problem.facebook page continuously refresh. sory to say am a noob in this field. can you tell me what the reall problem.
    see my application and please tell me. http://apps.facebook.com/it-ilam/
    email me. or reply here. am check this site every 1 hour. Thanx you very much.

    • mahmud ahsan May 3, 2011 at 11:59 pm #

      Hello, remove all the extended permission from the login, and test what happens.

  21. hitesh May 4, 2011 at 11:44 am #

    hi, my facebook application goes to infinite redirection, please help me resolve this.

  22. Sourav Ghosh May 5, 2011 at 9:25 am #

    This is my new app [just 1.5 months old], so i dont have those settings like your own in the image you provided !
    So, what ever i can change, i changed, but the problem still exist !
    http://apps.facebook.com/my_cartoon_face/

    • nakres May 5, 2011 at 7:15 pm #

      did you download the last version of PHP SDK ?

  23. Sourav Ghosh May 6, 2011 at 7:10 pm #

    Yes, i’m using the latest PHP SDK

    • nakres May 6, 2011 at 7:23 pm #

      for me, I did the changes here described and updated the sdk, it worked and still working.

      see if you are missing anything

  24. Sourav Ghosh May 7, 2011 at 11:06 am #

    I’m using PHP-SDK from this link
    https://github.com/facebook/php-sdk/zipball/v2.1.2
    and my sample code

    $facebook = new Facebook(array(
    ‘appId’ => $fbconfig['appid'],
    ‘secret’ => $fbconfig['secret'],
    ‘cookie’ => true,
    ));

    $session = $facebook->getSession();
    $loginUrl = $facebook->getLoginUrl(
    array(
    ‘canvas’ => 1,
    ‘fbconnect’ => 0,
    ‘req_perms’ => ‘read_stream,publish_stream,status_update,offline_access’
    )
    );

  25. Ahsan Javed May 12, 2011 at 1:00 am #

    Perfect. Worked for me.

    Thanks
    Ahsan

  26. Calebe Aires May 18, 2011 at 3:54 am #

    Hi.
    I have used SDK Facebook with Codeigniter. I tried to apply your fix, but it still do the infinit loop.
    The code I have used is: https://bitbucket.org/deth4uall/facebook-ignited/overview
    May you help me?

    • MCemil August 6, 2011 at 1:03 am #

      Hi,

      Did you solved the looping problem @ SDK Facebook with Codeigniter

      • mahmud ahsan August 6, 2011 at 2:54 am #

        As CI removes value from $_GET so use the below code, hope it solves your problem.

            
        public function __construct()
            {
                parent::__construct();
                parse_str($_SERVER['QUERY_STRING'], $_GET);
            }
        
  27. shawn May 25, 2011 at 3:37 am #

    I used your tutorial for SDK 2 and everything worked fine. Now I uploaded new SDK 3 and your new files iframe app. I cant fix this redirecting issue. I followed all of your steps, but still stuck. ur help will be appreciated.

    thanks for this tutorial!

    • mahmud ahsan May 25, 2011 at 12:11 pm #

      Did you check my latest post about SDK 3.0 ?

      • sanjay June 1, 2011 at 11:18 am #

        yes,..it’s slightly change…

  28. sanjay June 22, 2011 at 4:30 pm #

    hello,

    i get login and logout problem ….

    while login to my application and run code update status…it update user status…after click on logout i unable to logout even if i logout from my facebook account and login as different account then also it update status of first login user

    plz help me….

    i have taken code from ur tutorial

    thanks in advance,
    sanjay parate

  29. IG June 30, 2011 at 8:04 am #

    I did as the tutorial said and it worked perfect for me

    Thanks

  30. Tarun September 4, 2011 at 1:03 am #

    Getting Error while loading page from App NAME Empty response received.ANY SOLUTION FOR THIS PROBLEM

  31. rafael cardoso September 7, 2011 at 11:56 am #

    hi, I wonder if you could help me, I am using php sdk 3.1.1 and after the user acept the permision to go to my app; the url the “next” parameter points to my domain instead of apps.facebook.com/appname, so the user goes do my page, instead of facebook iframe page.
    any help would me appreciated.

  32. apophis1412 September 18, 2011 at 11:34 pm #

    Thanks Mahmud, you’re a genius. I’ve lost 1 week to debug it until I find out your solution:D
    youre great:D

  33. Erik September 19, 2011 at 3:02 pm #

    Hey mate,
    I have used your source files to see if I could replicate your test app, but it seems I am also stuck in the infinite loop.
    I have updated to the latest fb sdk.
    It worked fine initially but when I tested it from another facebook account it did not work.

  34. Mufaddal July 29, 2012 at 7:43 pm #

    hi,

    i updated to latest version of sdk, but still the issue is there…

    my scenario is i have a tab app and on authentication it goes into a infinite loop, can you confirm what should be the redirect uri value as i tried setting to the all canvas url, tab url and the url which is generated when clicking on the tab in the facebook.

  35. Ccc December 3, 2012 at 10:32 pm #

    overwrite latest sdk files. thats solved my loop error

  36. Troy January 3, 2013 at 9:33 pm #

    Having this infinite loop problem, also. Thanks in advance for your help, Troy Cloudmit – Web Services Since 1999

  37. Denz June 9, 2013 at 5:48 am #

    Infinite loop problem. There’s a Fix?

  38. Selim "WaLTaRRoN" Temel August 23, 2013 at 6:43 pm #

    Hello, I’ve fixed my problem with constant refresing by updating SDK version to latest(v.3.2.2) + disablind the “Client OAuth Login” option in Settings>Advanced. So I thought this might help.

Leave a Reply