Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook App: localhost no longer works as app domain

I've been writing a game for Facebook using Rails and jQuery. Since I started using the Facebook Javascript SDK, using localhost as an app domain seemed to work just fine. I was able to test my game both locally and on Heroku.

In the past day, it seems that Facebook has made a big update to their developer UI. Now if I add localhost as an app domain, it gives me the following error:

This must be derived from Canvas URL, Secure Canvas URL, Site URL, Mobile Site URL, Page Tab URL or Secure Page Tab URL. Check and correct the following domains: localhost

My game also now doesn't work locally and I get an error when the Javascript SDK logs in the user:

API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.

This doesn't happen when I deploy my game, since herokuapp.com is considered a valid app domain.

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

like image 288
Ravenstine Avatar asked Jan 22 '14 23:01

Ravenstine


People also ask

How do you fix facebook apps error can't load URL the domain of this URL isn't included in the app's domains?

Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

How can I login to facebook in localhost?

You need to register as facebook developer and create you app there. Once you have your web app registered you can go to your app and click on add product. Add Facebook Login. Then enable Web OAuth Login and add your localhost in the textfield below and save, you should be able to access it.

What is facebook app domain?

It's simply the domain that your "facebook" application (wich means application visible on facebook but hosted on the website www.xyz.com) will be hosted. So you can put App Domain = www.xyz.com.


2 Answers

The protocol seems to keep changing, and the accepted answer didn't work for me today. In case it helps other searchers, this is what did work for me:

  • All changes were made on the Settings page under the Basic tab

1.) In the center under the first box of options, click "+ Add Platform" and choose "Website" (or whatever is appropriate for your app.)

2.) In the box that comes up for the website you just added: Site URL: http://localhost:3000/

3.) In the box above that (Settings => Basic): App Domain: localhost

4.) At the bottom right - click "Save Changes"

5.) Make sure you have the app ID copied and pasted correctly into your code. (The ID is in the first box on that page if you need it again.)

like image 112
Taylor714 Avatar answered Sep 22 '22 12:09

Taylor714


  1. Go to your App's settings page in http://developers.facebook.com
  2. Click on the dropdown arrow on the top left (next to the name of your app) and click "Create Test App" and give it a name
  3. In the Settings > Basic of that new Test App set the App Domains as "localhost"
  4. Also set the Website Site URL as "http://localhost:8888" (or whatever port you are using).
  5. IMPORTANT: this app has different App ID and App Secret from your online application. So, last step: make sure that you update the code that sits in your localhost with the Test App's App ID and App Secret. On the contrary, the code that sits in the live server should be using the main App's ID and Secret.
like image 31
georgios Avatar answered Sep 24 '22 12:09

georgios