Building an application that uses Facebook Connect for login? Want you test the login locally? Here is how you will be able to use facebook connect locally:
1. Go to your application page on facebook. http://www.facebook.com/developers/editapp.php?app_id=xxxxxx
2. Select “Web Site” tab from the sidebar.
3. Add local.domain-name.tld to “Site Domain” field.
4. “Save Changes” on facebook.
The next steps depends on your OS:
If you are on unix/linux type system:
5. Open the file /etc/hosts, in your favorite text editor. (You will need root access to modify the file).
6. Add the “127.0.0.1 local.domain-name.tld” at the end of the file. For example. “127.0.0.1 local.magazinify.com”
If your are on Windows:
5. The file to edit will be:
(Considering your OS is installed in C drive)
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home/Vista/7 c:\windows\system32\drivers\etc\hosts
6. Open the file with Administrative rights in your text editor.
7. Add the “127.0.0.1 local.domain-name.tld” at the end of the file. For example. “127.0.0.1 local.magazinify.com”
8. Go to command prompt(press win-key+r then type cmd and press enter)
9. Type the command “ipconfig /flushdns”
Incase you get a SSL error, something like “Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed thrown in ……/facebook.php on line 512”
Add the following in your curl options:
CURLOPT_SSL_VERIFYPEER => false and
CURLOPT_SSL_VERIFYHOST => 2
Now you can use the Facebook Connect login on your local machine, just access your project from http://local.domain-name.tld/path-to-project instead of http://localhost/path-to-project from your local machine.