How to log in using facebook in a development environment using django social-auth?

I am using social-auth with my django web application. When I go to / login / facebook in the working environment, the user can log in using his facebook data. However, in my development environment, when I refer to

http://localhost:8000/login/facebook/, 

I get an error

 An error occurred. Please try again later. API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration. 

I believe this is because the domain is localhost: 8000. How do I fix this so that I can log in using facebook in my development environment?

+6
source share
2 answers

I just saw the answer to this while reading the Heroku / Facebook documentation.

To do this, you must create a second application and associate it with your local host in order to check it locally.

Further information on this can be found here: https://devcenter.heroku.com/articles/facebook#1-creating-a-development-facebook-app

+2
source

The easiest solution I've found is to modify the hosts file to trick Facebook:

1 / Edit the hosts file

  • Open / etc / hosts
  • And add this line to the end: 127.0.0.1 dev.mydomain.com

2 / In the Facebook dev console ( https://developers.facebook.com/apps/ *********)

  • Choose Test Applications> Create Test Application
  • In Settings> General> Add a domain (dev.mydomain.com) in the Application Domains field.

Done!

Wed: https://groups.google.com/forum/#!topic/django-social-auth/gB1D8ikgUwM

+2
source

All Articles