Facebook app: localhost no longer works as an app domain

I am writing a game for Facebook using Rails and jQuery. Since I started using the Facebook Javascript SDK, using localhost as the application domain seems to work very well. I was able to test my game both locally and on Heroku.

On the last day, it seems like Facebook made a big update to its user interface for developers. Now, if I add localhost as the application domain, it causes the following error:

This should be obtained from the canvas URL, secure canvas URL, website URL, mobile site URL, page URL or page URL of the secure page. Check and correct the following domains: localhost

My game also now does not work locally, and I get an error when the Javascript SDK is registered by the user:

API error code: 191 API Error description: The specified URL is not owned by the application Error message: Invalid redirect_uri: This URL is not allowed by the application configuration.

This does not happen when I deploy my game, since herokuapp.com is considered a valid application domain.

How should I develop and test my game if I can no longer use localhost or 127.0.0.1?

+81
javascript ruby-on-rails facebook heroku
Jan 22 '14 at 23:00
source share
11 answers

The protocol seems to be continuing to change, and the accepted answer did not work for me today. In case this helps other searchers, here is what helped me:

  • All changes were made on the "Settings" page on the "General" tab

1.) In the center, under the first field of options, click "+ Add Platform" and select "Website" (or something suitable for your application.)

2.) In the field that appears on the website that you just added: Site URL: http://localhost:3000/

3.) In the field above this (Settings => General): Application domain: localhost

4.) In the bottom right corner, click "Save Changes"

5.) Make sure the application code is copied and pasted correctly in your code. (The identifier is in the first field on this page if you need it again.)

+221
Jun 16 '14 at 22:13
source share
  • Go to the app settings page at http://developers.facebook.com
  • Click the down arrow in the upper left corner (next to the name of your application) and click "Create a test application" and give it a name
  • In the "Settings"> "General" section of this new test application, set "Application Domains" as "localhost"
  • Also set the site URL as " http: // localhost: 8888 " (or any other port that you use).
  • IMPORTANT: This application has different application and application identifiers from your online application. So, the last step: make sure that you update the code that resides on your local host using the App App App and App Secret. On the contrary, the code located on the real server should use the main application identifier and secret.
+23
Jul 03 '16 at 18:22
source share

You can still test your application without deploying it to a remote server such as heroku. The trick is updating the etc/hosts as follows:

 127.0.0.1 mydomain.com 

Then in the settings of the Facebook application, enter [ http: //] mydomain.com without "[" and "]"

It worked for me that way

+12
Jan 21 '15 at 9:17
source share

This is the wrong way. You must create a test application using the Test tab in the application settings. And then you can enter your development phase URL (e.g. localhost) into your application.

+6
Jan 11 '15 at 11:07
source share

Just add localhost as the URL of your canvas or mobile site, this will allow you to have both localhost and herokuapp.com in your domain settings. Then, once your application is ready, just uninstall it.

+5
Jan 23 '14 at 15:57
source share

Solution Using Firebase

To make this work on localhost , port 3000 , I did the following:

  • Create application

Create a test application

  1. Now select "+ Create Test Application" in the drop-down arrow list (top left).

enter image description here

  1. Add localhost to application domains

enter image description here

  1. Add http://localhost:3000/ to the site URL using the selected "+ Add platform"

enter image description here

Until that moment, I followed all the previous answers presented here, but nothing worked.

So...

  1. On the left menu, select "Add Product"

  2. Add Facebook Login

You will be presented with a workflow carousel with the default domain http://localhost:3000/ , click "continue" to the end.

  1. Choose Facebook Login> Settings from the product menu.

  2. Enter your Firebase OAuth redirect URI (found when enabling Facebook login in your firebase console https://console.firebase.google.com , example below)

enter image description here

  1. Insert URI and Save.

enter image description here

Done.

+4
Sep 25 '17 at 22:09
source share

For everyone who walks with this in 2017. The interface has changed again. I wanted to comment on this, but I do not have enough reputation. Your application’s local URL should now be copied to three places. Currently (October 26, 2017) the sequence:

1.) Click "Settings" on the left menu.

2.) In the center, under the first field of options, click "+ Add Platform" and select "Website" (or something suitable for your application.)

3.) In the field that appears on the website, you just added a copy of your localhost website URL (fe http: // localhost: 3000 / )

4.) In the box above "Domain Domain", copy the same URL

5.) In the lower right corner, click "Save Changes"

6.) In the left menu, in the "Products" section, click "Login to Facebook" (or add it via "+ Add Products" if it is not available)

7.) Now you are in the Facebook login settings. Copy the same URL into the "Valid OAuth Redirect URIs" box

That should work.

+4
Oct 26 '17 at 2:04 on
source share

Try using url with port e.g.

  http://localhost:8000/ 

I had the same problem and found this solution right now.

+2
Jan 24 '14 at 17:12
source share

This works for me in heroic, the localhost item doesn't work (for me). I hope this helps

1.) In the center, under the first field of options, click "+ Add Platform" and select "Website" (or something suitable for your application.)

2.) In the field that appears on the site that you just added: Site URL: http://MYAPP.herokuapp.com/ (replace MYAPP with the name of your application)

3.) In the field above this (Settings => General): Application domain: MYAPP.herokuapp.com (replace MYAPP with the name of your application)

4.) In the bottom right corner, click "Save Changes"

+1
Jul 15 '14 at 17:15
source share

Just a note for some others who may be struggling with this, just like me. I was not able to get this to work with "test" applications. Using my actual application settings (and just adding

 "http://localhost:3000/" 

to my canvas URL), like everyone else. Test apps don't seem to equal real apps.

+1
Aug 05 '14 at 5:03
source share

For me, it worked like this:

Customizing the facebook application toolbar:

* In the "basic" tab:

1) Leave the application domain empty.

2) Erase any platform. Meaning: There is no website without a canvas. (so the site URL field is not populated)

* On the "Advanced" tab:

3) I entered the URI with a redirect of a valid OAuth:

 http://localhost/myappfolder/redirect.php 

4) regarding my code, insdie my c: /xampp/htdocs/localhost/myappfolder/index.php (this file does loginURL):

 $helper = new FacebookRedirectLoginHelper('http://localhost/myappfolder/redirect.php'); 

inside the redirect.php file:

 $helper = new FacebookRedirectLoginHelper('http://localhost/myappfolder/redirect.php'); 

and I got a session! eventually! no need to hang at the end: P

0
Dec 16 '14 at 20:08
source share



All Articles