Opi
Opi

Reputation: 1308

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

Upvotes: 1

Views: 366

Answers (1)

C3roe
C3roe

Reputation: 96383

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.

Upvotes: 2

Related Questions