How to test Facebook Login on localhost with django ?

Facebook Login Process

In order to add “Connect with facebook” functionality ,at First You have to create a facebook Application from here

Now you have a Facebook “App ID/API Key” and “App secret” which are used for authentication process

The facebook application must be on a web domain and if you registered with “Heroku Apps” when you view your app on facebook you shall find your App Domain Field is set to “YOUR_APP_NAME.herokuapp.com”

The main problem was to test the “Connect with facebook” feature with a localhost since facebook doesn’t allow developers to use localhost as their App Domain,so to fix this problem you have to do the following :

First you have to install python,and configure it’s system environment path if on windows

1-Sign up on pagekite with your name (e.g yourname.pagekite.me)

2-download the pagekite client application from here

3-Navigate with your Terminal or cmd to the directory of the downloaded file then execute the following command on windows

python pagekite.py 8000 yourname.pagekite.me

or just

pagekite.py 8000 yourname.pagekite.me

on UNIX

where 8000 is the port number and it’s 8080 by default

if everything went well,to test if everything is working, run your localhost server and then try to access your domain on page kite (yourname.pagekite.me) you shall access your localhost now from the domain

Now if you configured pagekite correctly

Edit you “App Domain” on facebook to “pagekite.me” and “Site Url” to “http://yourname.pagekite.me

And now you can test your application by deploying your app on your localhost and then open “yourname.pagekite.me” and test your application from there.

Configuration with Django

install Social-auth library from here then follow the documentation to configure the desired social authentications you need from here

Leave a comment