views:

52

answers:

2

Hi,

I'm using the following step by step guide to connect to Facebook Connect:

http://msdn.microsoft.com/en-us/windows/ee702803.aspx

However I have a problem at the 'Authentication and Initiating a Session' stage.

When I go through the steps, I click on 'Connect' in my browser, which opens a popup, where I login to Facebook and 'Allow' the application to access my account. I'm then redirected to the filename I specify in thw 2nd parameter of the javascript function 'FB.init'.

However, this page then displays:

"Please sign-in with Facebook."

Why is this happening? I'm developing this on localhost, I don't know if that could cause a problem? Please help! Thanks.

A: 

I ran into a similar problem where I could not test Facebook on localhost. Due to security requirements from Facebook you must test from the domain you used to register your application.

Create a dev.yourname.com subdomain and test it there.

Todd Moses
This is actually not correct. As long as the url on your app settings matches your local url you can debug locally.
Nathan Totten
That is the point. The app setting must match. So to develop local then you need to set Facebook to localhost. It is better to have a dev environment and do it there.
Todd Moses
+1  A: 

You actually can use localhost. The one problem you may have is that there is a bug with the Facebook Javascript SDK in internet explorer if you are on a port other than 80 or 443. http://github.com/facebook/connect-js/issues#issue/106

If you check out my Facebook .Net SDK on codeplex you can download the sample app. As it is configured it will run locally. The one thing is you need to set your site url and/or canvas url to point to http://localhost:port#/

Do download the sample go to: http://facebooksdk.codeplex.com

Nathan Totten