Search code examples
djangodjango-authenticationdjango-allauth

django-allauth Social Network Login Failure with Facebook and Google


I'm using Facebook and Google login in my app using django-allauth. I followed the readthedocs documentation of django-allauth to create apps on google and facebook and use the APP ID and secret to login into the website. In the settings.py file I specified the LOGIN_REDIRECT_URL to redirect the user after login. However, when I login using facebook or google button, I get the following error-

Social Network Login Failure
An error occurred while attempting to login via your social network account.

In the Authorized redirect urls in google app I specified the redirect path as mention in the documentation, however, couldn't find where to specify the Redirect url in Facebook app. I searched the already existing SO questions based on this error but couldn't find a solution to apply to my web app. Please help.


Solution

  • I faced this error during facebook login in django-allauth. It was because I registered in facebook using 'localhost'(as it doesn't allow 127.0.0.1) and my request was made through 127.0.0.1(default given by manage.py runserver).

    Also ensure that you have added url to 'sites' in django admin and the request made to facebook is from correct site only ('chosen site' in social application inside django admin)