Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make Facebook's graph API work on my localhost?

the title might suggest it, but i'm looking for a way to have Facebooks graph API work on my localhost. It's a pain if I need to sync up the project to the server every time I want to test, because graph only works when online.

Does anyone have any suggestions on this problem?

like image 249
Michiel Standaert Avatar asked May 02 '11 14:05

Michiel Standaert


People also ask

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.

Is facebook Graph API a REST API?

The Legacy REST API is in the process of being deprecated, while the Graph API is the most current, so if you're unsure of which one to use, your best bet is to go with that one. As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.

Is facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.


2 Answers

If you don't need offline access (which is not available, see Jimmy Sawczuk's answer), but only need your website to be able to access the Graph API from your localhost instead of the real domain name, it should be possible.

What you need to do is edit the settings for your site's app on Facebook. Set your applications URL to either 'localhost' or your computers local IP-address, and I think it should work.

like image 86
Adrian Schmidt Avatar answered Nov 06 '22 21:11

Adrian Schmidt


tl;dr

  1. Setup the facebook app
  2. Edit your /etc/hosts file with a local.yourdomain
  3. use your browser on local.yourdomain

Follow the instructions described in this post for the how-to: How To: Local Facebook App Development

like image 39
Sebastian Sastre Avatar answered Nov 06 '22 20:11

Sebastian Sastre