Can i run a facebook application hosted on localhost - facebook

Is it possible to run a facebook hosted on localhost?Will other users throughout the world will be able to use that app or the firewall will be blocking facebook from fetching content from my computer when users request for it?

Firewalls don't even get a chance to intercept it.
"localhost" is on a non-routable network by definition of IPv4. I can not reach your home computer by name reliably and "localhost" will always resolve to the local host.
There are some tricks that you can use to make your home machine visible to the outside world, but they are not reliable and I really don't want to use a service that went down because your Angry Birds game crashed your machine.

In your app's basic settings (https://developers.facebook.com/apps) under Settings->Basic->Select how your app integrates with Facebook...
Use "Site URL:" and "Mobile Site URL:" to hold your production and development URLs. Both sites will be allowed to authenticate. I'm just using Facebook for authentication so I don't need any of the mobile site redirection features. I usually change the "Mobile Site URL:" to my "localhost:12345" site while I'm testing the authentication, and then set it back to normal when I'm done.

Related

Facebook Application Privacy policy

A web appliction is running on my local machine (can't be accessible from Internet, it is a developer site, not the production one), e.g. URL:1 http://myapp.com.
I want to configure a Facebook app on my web application. Created Facebook application, App > App Details, at Privacy Policy URL given URL:1 this message appeared:
"You must submit a valid Privacy Policy URL in order to be compliant with Facebook Platform. Request failed with error: Can't Download: Could not resolve the hostname into a valid IP address."
My application is a development site. I can't expose it on a public domain. I don't have Privacy Policy URL on public domain. What would be the best solution?
It has to be accessible and public. You can´t enter a link that only runs on your local machine, Facebook obviously can´t check if it´s there.

AIR SocketServer mobile app and policy file

Building an AIR based mobile application which will only be used over a local wifi network.
The SocketServer class will be used to load and save high scores.
Will I need to make use of a policy file?
Probably, pretty much if you are requesting a resource from anywhere other than the same port and host as where the .swf came from you will probably need a policy server and a crossdomain file.
Edit: The reason for this is security. Imagine you are working at a corperate office behind a firewall browsing the web. A malicious flash ad is on a site you are visiting and starts copying intranet files from your browser (which is behind the firewall) and uploading them to a secret location. The policy server ensures that servers you access want you to access them, and can specify what exactly you are allowed to access.

Facebook App: any way to run the app without SSL?

I am working on my first app for Facebook and facing (probably) with the SSL problem. If I am testing the app, so it's working well. But then I wanted to test the app by my friend - so I assigned him the role "Tester", he accepted it and I sent him the link to the app.
If he opened the app, he got the error The website is not available - Error 501 (net::ERR_INSECURE_RESPONSE): Unknown error
I started google it and it looks that the cause is the missing SSL certificate on my hosting, where the app is stored.
BUT - how is possible, that the app is working me well without the SSL and to my friend doesn't? If the SSL is required for Facebook apps, why I didn't get the same error?
(I set Secure Canvas URL: to https://example.com/fb-app-directory/, however I don't have at this domain and hosting any SSL certificate).
I never used before SSL. I bought the domain name on Namecheap and hosting on Hostgator. So now, I should buy a SSL certificate from the offer (http://www.namecheap.com/ssl-certificates.aspx) of Namecheap, right?
Would be suitable for the Facebook app the cheapest one?
Look, this SSL problem can only be solved by purchasing a valid SSL certificate or looking for a server which can host your app and is SSL certified such as:
phpfog.com - Provides you with some limited space and database service.
heroku.com - Does not provide any storage space for saving dynamically generated data. To have that service, you have to buy the Amazon buckets service which, again, is a costly affair.
If you don't want to invest any money, I would recommend that you go with phpfog - it is easy and its documentation is pretty good.
You should buy an SSL cert in order for everyone to be able to access your app. Your friend probably has his settings set so that he browses Facebook securely, in this case he is hitting https://example.com/fb-app-directory/, not your actual URL.
The cheapest one isn't the best one, but it should work as long as it's valid. I would suggest using Heroku though, as that way you get everything you need - for free :)
Use a proxy in heroku.com and bring your page in secure domain as https://yourapplication.herokuapp.com/
"Starting October 1, 2011 Facebook will require a valid SSL Certificate for all pages and applications hosted outside of Facebook."
http://www.wpcode.net/fb-ssl.html/
Maybe you are visiting your application with http://apps.facebook.com/... and your friend is visiting with https://apps.facebook.com/....
Another possibility is that your friend has checked "Browse Facebook on a secure connection (https) whenever possible" under "Account Security".
Try ngrok. It exposes a local web server with just one command:
ngrok 80
After this you can access your localhost like this: xxxxxxxx.ngrok.com

Use facebook login in localhost

I am doing a project and need to use the facebook API as user login.
The document are clear the usage of the login button of login with facebook.
However, when I test the button on localhost, it gives nothing to me, no error page, no popup windows.
I am using xampp for my local development and the site url that I fill in app setting is http://localhost:8880/atrain/
can someone help? I have searched the internet and change the hosts file but still unsuccessful.
Set up your local server to use the standard http port (80) and use a virtual host with a TLD. It can be a fake TLD such as:
localhost.dev
How you actually accomplish this depends on what type of web-server you are using.

How to test Facebook Real-time updates

In order to publish real-time updates to my app, Facebook needs needs to perform a post request to my server.
Problem is, my server is my home computer and not publicly addressable from the internet. Bringing a server live to implement this sounds like it could be a pain... can't attach debugger, fiddler etc....
So what's the best way to test the Http Endpoint? Integration tests that simulate the Facebook server? Fiddling with firewalls/NAT to try and get Facebook talking to my home computer?
Any ideas?
You can use ngrok - https://ngrok.com/ - free (pay-what-you-can) service that does exactly what you need. Localtunnel service is down and the developers also recommend ngrok.
In the past, I've used LocalTunnel to do this. It's a nice wrapper around an SSH tunnel and it effectively assigns you a subdomain at localtunnel.com pointing to a port on your localhost.
So basically, when you run it it will spit back an externally accessible sub domain name like xyz.localtunnel.com who's port 80 will point a port you specify on your local box.
You can find it at: http://progrium.com/localtunnel/
It's really great for testing various pubsubhubbub subscription feeds (like Facebook's).
OK! I think NAT should be the best bet and I don't see a reason for it not to work. You should try it out.
It was actually pretty easy - Logged into my home router, set up port forwarding on port 80 to the local IP of my computer, put an exception in windows firewall for port 80. and then navigate to my public IP address in the browser.
Implement the receiver samples at: https://github.com/facebook/real-time/tree/master/samples
The only answer is to get a webserver that is publicly accessible for real-time updates to be able to call back to.
There's lots of free webhosts that allow server-side scripting. And there's lots of paid for webhosts out there too. Stackoverflow is really not the place to get leads on where/when/why/howmuch for web hosting.
No you can't use ngrok only to simulate facebook realtime update since you must make a call to facebook servers with your ngrok adress to validate it (tell me if you find out how to do this :p ).
I use an openshift server to receive facebook realtime and then post evry json data received from facebook to my ngrok adress. So the process is
set up an openshift server to receive facebook notifications
Facebook sends notifications to your openshift
your openshift sends datas (as received) to your ngrok adress
And if you must receive facebook notifications on a local website (like www.website.dev/fb-notifications/) then create a script in your localhost folder which receives openshift posts (let's call it tunelscript.php). the process will be
set up an openshift server to receive facebook notifications
Facebook sends notifications to your openshift
your openshift sends datas (as received) to your tunel script via your ngrok adress (perso.ngrok.com/tunelscript.php)
Relay datas from your tunelscript to your local website (tunelscript.php => www.website.dev/fb-notifications/)
That's Tuneling B-)