Difference between revisions of "Facebook Connect on localhost"

(Final Result)
Line 36: Line 36:
 
Be careful that if if you try to access the localhost on a standard way by just typing localhost or 127.0.0.1 in the address bar, the Facebook Connect will fail. Also, if for whatever reason this trick dont work for you, then please take your time to setup the FBC on some publicly available domain as many factors can affect the fail such are firewalls for example, which are beyond our reach.<br/>
 
Be careful that if if you try to access the localhost on a standard way by just typing localhost or 127.0.0.1 in the address bar, the Facebook Connect will fail. Also, if for whatever reason this trick dont work for you, then please take your time to setup the FBC on some publicly available domain as many factors can affect the fail such are firewalls for example, which are beyond our reach.<br/>
 
But be advised that this is tested, and working.
 
But be advised that this is tested, and working.
 +
 +
==See Also==

Revision as of 10:34, 6 March 2013

Overview

Probably more often then not you wanted to test the Facebook Connect feature on your localhost before deploying it on a live site and you simply didnt found the way how to do that. Facebook of course will not recognize the localhost as valid web server online and will probably wont even allow you to create the application that points to localhost. So, youre doomed to try the Facebook Connect only on the server that is publicly available?
No, not at all

Modifying the hosts file

First thing you need to do is to point your domain name to the localhost IP address

127.0.0.1 mightylocal.dev


This domain name can be practically set to anything you like, it can be even dfdgter.khdfslsdfp as long as you're able to remember it.
To make things a bit easier, lets just call our localhost server mightylocal.dev
So, for Windows users, one needs to navigate to C:\windows\system32\drivers\etc\hosts and add the line above at the bottom. For Mac/Linux users, this file is normally located at /etc/hosts although this can vary with different Linux distributions

Setup the Facebook App

Create the Facebook App exactly as outlined here, only this time, you will use the mightylocal.dev for your domain name as shown in picture bellow
Mightylocal.png

Final Result

After you have set the Facebook Application and copied the keys into respective JomSocial configuration, you must visit your localhost site frontend by going at this address

http://mightylocal.dev


or

http://mightylocal.dev/path/to/your/joomla/test/site


Yes, the app will work for all subdomains too
Now when youre on http://mightylocal.dev try to use Facebook Connect. If everything went okay, youll be able to use it
Mightylocal1.png

Note

Be careful that if if you try to access the localhost on a standard way by just typing localhost or 127.0.0.1 in the address bar, the Facebook Connect will fail. Also, if for whatever reason this trick dont work for you, then please take your time to setup the FBC on some publicly available domain as many factors can affect the fail such are firewalls for example, which are beyond our reach.
But be advised that this is tested, and working.

See Also