How to test a Facebook app locally using Google App Engine - facebook

So, I know there are a lot of similar (or, let's face it, exactly the same) questions on this board. However, they're all from quite some time ago and I've tried the solutions put forth in them and they don't seem to work. I thought I'd ask it again, and preface also that I have relatively little experience so please bear with me.
I'm writing a Facebook app, and I want to be able to test it locally, but Facebook won't let me put "localhost" or 127.0.0.1 or my IP address into the "App Domains" field, so I can't use them. I only get these two errors:
App Domains: http://localhost:11080 should not contain protocol information.
App Domains: http://localhost:11080 is not a valid domain.
How can I get this to work? It's really obnoxious to have to deploy my code every time I want to change one little thing...
Let me know if you need more information from me. Thanks!

Just put localhost in "App Domains" field instead of the complete URL.
App Domains: localhost

Related

Facebook App - localhost & force https problem

Yet another Facebook app/API post I know, but please read carefully.
For better clarity, I'll add here that we're currently in 2021, March 29, their API has changed quite a lot over the last few months (and might change as well), therefore most answers on StackO aren't working anymore.
Furthermore, IMO their documentations aren't fully updated yet to the current version, and have things that doesn't exist anymore (like Dev/Live mode for ex).
After making sure that my app can work with my localhost by changing:
Settings -> Basic -> App Domains -> 'localhost'
Settings -> Basic -> Add platform -> Website -> 'http://localhost:8000/')
Add Product -> Facebook Login -> leave everything empty
Make sure to run my localhost with localhost and not 127.0.0.1.
It seems that the Facebook JavaScript SDK doesn't work from an http url.
As I'm working on localhost (so not in https) it is quite annoying. After checking the FB documentation and some tooltips in the Facebook login settings, it seems that localhost should work without https enabled. And if that wasn't enough: the Enforce HTTPS button is greyed-out and cannot be turned off anymore.
I also tried to put something in the Valid OAuth Redirect URIs, but the field/tooltip doesn't let you put http://localhost:8000/:
http://localhost redirects are automatically allowed while in development mode only and do not need to be added here.
As mentioned above, there is no such thing as development mode anymore, or at least no button or anything to change or even see the mode on their new interface.
Did anyone managed to make his localhost work with the JS SDK?
Ngrok and other answers are indeed appreciated, but I would like to know first if there is a "real" solution (on FB side) at this problem ("No there isn't yet" is an acceptable answer as it will probably save a lot of time for other people).
Thanks a lot!
Edit: The dev/live mode distinction still exists, but only for apps developed by individual developers. For business apps, they have been replaced with access levels. (see comment, #CBroe)
However, I tried without being in business, but it didn't work either.
It seems like there isn't any solution for my problem on Facebook side, the JavaScript error clearly says:
The Login Button plugin no longer work on http pages. Please update your site to use https for Facebook login.
As the link in the error goes to a blog post (not the documentation) and as I didn't find anything related to that problem in FB doc, well... can't use it in http pages.
Therefore for other people searching for a solution, I would recommend another StackO thread on how to turn your localhost django app to run in https (as I'm working with Django).
For those working with Google Chrome, following the above thread, you'll need to turn off Chrome error about your connection not being private, here is how:
open a new tab
paste : chrome://flags/#allow-insecure-localhost
enable the option 'Allow invalid certificates for resources loaded from localhost.'
Please, feel free to post another solution to my question if there is finally a way to make it work, or an update from FB side later on.

Having an issue with phonegap facebook login without plugin

I have a phonegap app in iOS and I'm trying to do a login with facebook. I'm using the javascript sdk. When I try to use fb.getlogin status or fb.login, not sure which, it gives me this error:
"Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."
I have searched for this error, obviously, but nothing seems to solve my issue.
I looked in the facebook app settings, and everything seems to be in order.
I'm probably crazy for asking this with so little detail, but, any suggestions, ideas?
I have never used their SDK but I would have to guess that you are making the javascript calls from within your app and the SDK is saying that it doesnt recognize the URL that the call is coming from. Even though your phone doesn't have a URL (though you could give it one but that is a whole different story) it does still have an IP and that IP isnt matching what FB is expecting. I am sure you registered for a FB developer account or something like that and it asked for a URL of where the calls would be coming from. That needs to match. I dont know how you would get around this. I think you need to use the plugin.

How to test Facebook API actions locally?

I'm building a facebook app and so far so good but when I want to add an action (i.e. an article etc.) which would point to an outside url like "example.com/articles/12" it doesn't work since I'm developing using local urls like "localhost/dev/myprogram/articles/12" and Facebook obviously cannot fetch it.
What's a good way to solve this? Mind that the application doesn't exist on a live domain yet either, so I can't use that space.
I set up the app for the development with my localhost domain and since Facebook uses an iframe it works perfectly, but once I want to actually save objects it fails because of this problem.
so lets say I have an url like:
http://localhost/dev/myprogram/articles/12
then facebook first tries to parse it via
https://graph.facebook.com/?ids=http://localhost/dev/myprogram/articles/12&scrape=true
and then save the new object with something like
https://graph.facebook.com/me/myprogram:upload?article=http://localhost/dev/myprogram/articles/12
This will fail because even though Facebook can reach my localhost trough the iframe, it cant reach this page from anywhere else.
Any workarounds for this?
Thanks
What's a good way to solve this?
Either get some publicly reachable space to test your stuff on (could be a subdomain of your actual project domain, for example) – or set up your local development machine to be reachable from the interwebs, by using a DynDNS service of some sort.

form submit leading to redirect after auth changes

After the recent auth changes, one application stopped submitting forms properly, and I can't figure out why. Here's my situation:
I have multiple apps that all point to the same codebase. Each app comes in with a separate identifier so i know which app to display. All of my apps are working perfectly except one, which happens to be an older app (I created it in the summer, the rest were created within the past couple weeks, post-migrations).
I am using the php sdk (3.1.1) and all of my forms have actions of action="mysite.com/controller/function" instead of "apps.facebook.com/appname/controller/function". As of yesterday (December 15), when my one app submits the form, the receiving page is not finding any facebook connection and thus is breaking.
Once again, for most of my apps the receiving function is able to connect via $this->facebook->getUser(). It's only the one app where that returns null.
How is this possible? All of my apps use the same codebase, and I've programmatically made sure their migrations all look like this, the setting of the apps that work:
migrations=
{
"disable_auth_methods":true,"secure_stream_urls":false,"december_rollup":true,"apprequest_
counts":true,"page_tab_iframe":true,"read_notifications_permission":false,"recent_activity"
:true,"app_profile_page_deprecation":false,"gdp_v2":false,"page_hours_format":false,"graph_
batch_api_exception_format":false
}
Is there a setting wrong with my app? How else is it possible that the same codebase can serve two apps and have them act differently? I feel like I've changed every app setting I could find to no avail.
By the way: I know it's possible to have the action be apps.facebook.com/nameofapp but it doesn't solve the problem as to why this worked and then doesn't now. I'd like to root out the problem.
I figured it out. I completely missed a setting, and in hindsight it's very simple. My canvas url for the non-working app was:
http://www.mysite.com
and my form action was:
http://mysite.com
all the other apps had a canvas url without the www. and they worked fine. apparently when it went from www. to mysite.com, it would lose its facebook connection and need to redirect to the permissions page.
I hope this helps someone else out.

How do I import facebook friends from the another website

I am looking for a way to connect to facebook by allowing the user to enter in their username and password and have our app connect to their account and get their contacts so that they can invite them to join their group on our site. I have written a facebook app before, but this is not an app as much as it is a connector so that they can invite all their friends or just some to the site we are working on.
I have seen several other sites do this and also connect to Yahoo, Gmail and Hotmail contacts. I dont think they are using Facebook Connect to do this since it is so new, but they may be.
Any solution in any language is fine as I can port whatever example to use C#. I cannot find anything specifically on Google or Facebook to address this specific problem. Any help is appreciated.
I saw a first answer get removed that had suggested i might need to scrape the friends page. The more I look around, this might be what i need to do. Any other way i think will require the person to add it as an app. I am wondering how a answer can get removed, maybe that user deleted it.
Try This
Not sure if its possible explicitly but there are indirect ways to do it!!!
Here is another article that seems to cover what you want to do http://facebook-developer.net/2008/02/20/allow-your-users-to-invite-their-friends/