No Facebook Connect Cookies for Localhost Development

While doing some Facebook Connect development, I found that the expected cookies were not being set when developing on localhost.  To fix the problem, I added localhost.local to my hosts file (pointing at and changed the settings for my Facebook application to use localhost.local as the base domain.

17 thoughts on “No Facebook Connect Cookies for Localhost Development

  1. Worked for me too… don’t know why, this is a very strange bug

    For the record you add it to your hosts file by (on linux) adding this to the beginning of your /etc/hosts file: localhost.localhost

  2. THANK YOU!!!!!THANK YOU!!!!!THANK YOU!!!!!THANK YOU!!!!! this just finally concluded a full 8 hours of “why why why”…i could not get Facebook to connect in any browsers but safari…THANK YOU AGAIN

  3. Thank-you! I’ve spend over a week trying to figure out why the Facebook APIs were not saving the auth cookie.

    Here is what I did to get it working:
    1) Add “ localhost.local” to my host file

    2) Updated my FB application Connect settings to use “http://localhost.local/” URL and “localhost.local” domain.

    3) Create an IIS Web site on port 80 with the name “localhost.local”.
    – I had to stop my default web site, which is also on port 80

    4) Update my Visual Studio 2010 web application to use IIS with the “http://localhost.local/” url.


  4. hey all, i am unable to attach a debugger when i do this. I am unable to get this to work.

    Here is what i did:
    1) My compilation code is on an external hard drive.
    2) I created a new website in IIS and pointed the physical path to the external hard drive.
    3) Ran the debugging

    I get an error..any help would be appreciated.

    HTTP Error 500.19 – Internal Server Error
    The requested page cannot be accessed because the related configuration data for the page is invalid

    Module IIS Web Core
    Notification BeginRequest
    Handler Not yet determined
    Error Code 0x80070021
    Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false”.
    Config File \?K:DevelopmentSamplesFacebookSDK_V40r2SourceSrcFacebook.Samples.AspWebsiteweb.config
    Requested URL http://localhost.local:80/Default.aspx
    Physical Path K:DevelopmentSamplesFacebookSDK_V40r2SourceSrcFacebook.Samples.AspWebsiteDefault.aspx
    Logon Method Not yet determined
    Logon User Not yet determined

  5. BIG THX i suspected that was the problem but wasted couple of hours testing oter solutions 🙁
    Hope this gets to first result in google 🙂

  6. Thank you @CarlProthman and others for laying out the details! That filled in some gaps that helped me to get my Facebook integration working.

  7. Thank you so much. Afters days of struggling with this, and almost giving up, your post helped. Wonder why this is not documented on facebook. I hope your post soon shows up on the first page of google search for “facebook cookie not set”. It is currently at page 3.

Comments are closed.