How can I use localhost when developing facebook graph site?

I want to use localhost to develop facebook facebook application using api chart. I work in asp.net c #

in the previous facebook api, I was abe to write http: // localhost: 4300 / in the connection URL in the application settings.

Now this is an assistant professor. he keeps telling me An error has occurred with the application name. Please try again later.

any suggestions?

** if I load a website and use the coonect website url, it works.

+12
c # facebook facebook-graph-api
Jul 20 '10 at 10:55
source share
7 answers

Facebook doesn't care what the actual IP address is on your server, but it will check that the domain name of the link page matches the domain registered in facebook. The trick to getting it working during development is to find a way to use your domain name, even if you just work on your local development machine.

If you have full control over your DNS records, you can add a host record (for example, "test.yourdomain.com") that either points to the real IP address of your development machine (if it is a static ip), or simply up to 127.0.0.1

If you donโ€™t have access to your DNS, then the easiest way to get around this during development is to simply add an entry to your computerโ€™s file ("/ etc / hosts" on OSX and most other Unix machines), specifying the domain that you registered on facebook on the local host computer. so you would add a line like this:

127.0.0.0 test.yourdomain.com 

to the end of your hosts file. This means that if you log in to test.yourdomain.com now in your web browser, it will solve your local machine.

Now - in the "website" section of your Facebook application setup, make sure you add your domain name to the "website domain" section of this parameter - this will mean that Facebook will accept requests coming from any subdomain in other words, it will accept requests from "www.yourdomain.com" (your production server) and "test.yourdomain.com" (your local development machine).

Now you should just be able to develop your local machine using the URL "test.yourdomain.com" in your browser, not "localhost", and everything should work.

OH is another thing - redirecting uri to facebook will also need to have a port number if your development server is not running on port 80, but it includes this port number when matching the domain url (to be honest, I think this is a facebook API error ) This means that if your development server (for example) is running on port 8080, you need to add ': 8080' to the end of the host name in the redirect URI, but if your production server works on port 80, then you should not put ": 80" in the uri redirect, because otherwise it will only work when people explicitly include the port number in the URL that they used to view yours (unlikely on a working server). All this in practice means that you just need to have a conditional condition so that when generating the facebook authentication URL you include only the port number, if it is not port 80.

+21
Jun 14 2018-11-12T00:
source share

Add "localhost" to the "Domain Domain" setting of your Facebook application. Also, if you do something like redirecting "MyApp.test" to 127.0.0.1 on the local server, you can also add "MyApp.test" to the "application domain" and it will work.

I just tried this after finding a solution to this problem. This is a very simple solution.

+3
Nov 10 2018-11-11T00:
source share

In the settings of your Facebook application, check the following basic settings:

  • Namespace set
  • Application domain includes "localhost"
  • Canvas URLs and Secure Canvas URLs have the localhost domain in the URL

If you get an "application name" error when saving application configuration settings, are you sure that the application name is valid and not yet accepted? We constantly use localhost (with ASP.Net, IISExpress and very high port numbers) with four or five different applications with several users on different computers and never have to perform any additional steps described by some users in their answers.

EDIT: after re-reading the other answers, I assume some developers are developing in the same Facebook application, how do they use for production, so they need to map their machine to the production domain? We do not do this, we have two "applications". One of them is for testing with localhost configuration and the other for production. We have a component that defines the runtime environment it is in and creates all the necessary URLs, such as OAuth redirects with application identifiers and application secrets, so we always run the same code and the other configuration is deployed on different servers.

+2
May 03 '12 at 12:28
source share

Are you sure the problem is with the DNS name and / or port of your web server? If so, you can use your local IIS instead of the webdev server, set up yourdomain.com website and add an entry to hosts saying 127.0.0.1 yourdomain.com

0
Jul 20 '10 at 11:01
source share

If I understand correctly what you are trying to do, and the application settings are on the Facebook website, Facebook will not be able to connect to your computer using "localhost". Get the IP address of your computer and enter it on the application settings page.

To find your IP: http://whatismyipaddress.com/

0
Jul 20 '10 at 11:11
source share

You need to create ssh tunnel FROM development server to your local computer. Each request to the dev server will be processed by your computer and sent back.

0
Jul 20 2018-10-12T00:
source share

You cannot add top-level domains in Facebook FYI settings

0
Jan 15 '15 at 5:32
source share



All Articles