Testing your Facebook App in your Localhost

When creating an application that uses Facebook as an authentication method, a couple of things that you have to keep in mind so that you can test locally.

  1. Register your app at developers.facebook.com – Straight forward. This is where you’ll get your App ID, Secret ID and all them IDs.
  2. Change your app settings.
  3. This should reflect “Site URL – http://localhost.local/” and “Site Domain – localhost.local”

  4. Change your hosts file to reflect the change. This should point your 127.0.0.1 to localhost.local
    You can find the hosts file at C:\Windows\System32\drivers\etc\hosts. Make sure you run your notepad or any editing tool as administrator to be able to make the change.
  5. If you’re using IIS then you should take note of the default web site. It’s more straight forward if you’re running apache (I’m using XAMPP) as you just need to put it in the correct folder.
  6. If you didn’t get it right you’ll get an API Error Code: 191 API Error Description.
  7. When you start testing your app you should view the URL http://localhost.local/ instead of localhost only

Hope this helps and enjoy building your app!

Advertisements