Over the past few weeks/month I have been adding various third party plugins to allow users to connect to Journalhome using their favourite social network account, (to date I have added Facebook, Twitter and Linkedin).
But one of the problems I have been facing is, how to debug/test my Facebook app. When you create an app, (on your facebook developer account), it is expected to redirect to your live server. The obvious solution is to create a new 'test' account.
So lets say your test account is http://127.0.0.1/, (or whatever IP address/website you use), create a new app in facebook using that address. Make sure that all the values are as close as possible to your 'live' server.
I have been having some issues with htpp://localhost/, I think this is because facebook tries to parse the URL and it doesn't like it, so it might be better to use the ip address.
It did work some times, but not always, but when you debugging you don't want to have it nor work 'sometimes'.
Pay special attention to the 'Web Site' section, make sure that the site URL points to your test website, (even if it is local and only accessible to you). Facebook uses this address to allow only applications from that address to make 'calls'.
Note your new Application ID and Application secret, they are obviously not the same as your live application details.
And that's all you need to do with Facebook really, (You can also use port number like http://www.example.com:6141/) if you need to.
You now need to create some test accounts, to do that, download the facebook test user manager, it will allow you to create test accounts, (and delete them/edit them/add friends). Just copy the files somewhere on your test server and run it from there, (like http://127.0.0.1/testuser/).
That's all you need really, just make sure that your test server is pointing to the 'test' version of your application and Facebook will return you back to your test server.
NB: This might be stating the obvious, but make sure that you replace the App ID and App secret when you nove to the live server. In my case I have config files that are 'live' and 'test' to ensure that I don't need to bother about changing the app ID and secret.
That's it, let me know if you have an easier way of testing Facebook apps. I am also very interested to know if there are other tools to help you test your Facebook app.