No Facebook Connect Cookies for Localhost Development
January 20th, 2010While 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 127.0.0.1) and changed the settings for my Facebook application to use localhost.local as the base domain.




March 2nd, 2010 at 2:27 am
Wow that saved me going insane (pity about the last four hours).
Thanks heaps!
March 5th, 2010 at 7:13 am
Great Idea!! It works for me. Thank you!
March 18th, 2010 at 11:43 am
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:
127.0.0.1 localhost.localhost
April 19th, 2010 at 3:38 pm
Thank you so much. I can’t express how much frustration this was causing me. Thank you.
July 1st, 2010 at 8:05 pm
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
July 16th, 2010 at 9:05 pm
Life saver. Unbelievable that this was all it took! Thank you!
July 19th, 2010 at 5:08 pm
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 “127.0.0.1 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.
HTH
September 8th, 2010 at 2:20 am
How do you set the “hosts file”. Or where is it located?
Any help would be great!!
September 8th, 2010 at 12:58 pm
@Jez, on a Windows machine it is:
c:\Windows\System32\drivers\etc\hosts
October 11th, 2010 at 3:06 pm
It works excellently, thank you!!
October 15th, 2010 at 12:58 pm
Didnt work for me! And whats up with Carl Prothmans comment: why should I do step 3 and 4?
October 16th, 2010 at 4:14 am
[...] http://ardentdev.com/no-facebook-connect-cookies-for-localhost-development/ [...]
November 18th, 2010 at 10:04 pm
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 0×80070021
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:\Development\Samples\FacebookSDK_V40r2\Source\Src\Facebook.Samples.AspWebsite\web.config
Requested URL http://localhost.local:80/Default.aspx
Physical Path K:\Development\Samples\FacebookSDK_V40r2\Source\Src\Facebook.Samples.AspWebsite\Default.aspx
Logon Method Not yet determined
Logon User Not yet determined
April 21st, 2011 at 7:34 pm
BIG THX i suspected that was the problem but wasted couple of hours testing oter solutions :(
Hope this gets to first result in google :)
November 3rd, 2011 at 3:17 am
[...] No Facebook Connect Cookies for Localhost Development–Ardent … - Oversett denne siden [...]
December 27th, 2011 at 11:01 am
Its working I am ver happy now ummmmaaaaaaaaaa