Django-allauth and twitter integration - Network logon failure on the network

I am trying to work with django-allauth. I followed the instructions on the github page and did the following:

  • Added allauth urls to urls.py

    urlpatterns += patterns ('', url('^accounts/', include('allauth.urls')), url('^accounts/profile/$', ProfileView.as_view(), name='ProfileView'), url('^login/$', login, name='account_login'), url('^logout/$', logout, name='account_logout'), url('^login/cancelled/$', login_cancelled, name='socialaccount_login_cancelled'), url('^login/error/$', login_error, name='socialaccount_login_error'), ) 
  • Updated TEMPLATE_CONTEXT_DIRS , TEMPLATE_CONTEXT_PROCESSORS , AUTHENTICATION_BACKENDS and INSTALLED_APPS . Also added ACCOUNT_AUTHENTICATION_METHOD = "username_email"

  • Added the key and secret for twitter in the table of social applications.

  • Django-allauth templates were copied to my application directory and changed it. I see that all the templates work fine, like /accounts/signup/ and /accounts/social/connections/ .

Now, from the connections or registration, when I click the twitter /accounts/twitter/login/ link, I ended up with the following error:

Network logon failure

An error occurred while trying to log in through your social network account.

Am I missing something? Maybe some stupid mistake (Twitter login URL? No hints!). I also tried to find several manuals based on the latest database, but could not find them. The django-allauth example on github did not help. Please help. Also, please feel free to provide me with any links or guides based on the latest code base.

Thanks in advance.

+4
source share
1 answer

I am new, so you can expect some stupid mistakes from people like me, but I try to learn. I spent many hours trying to resolve this. Finally, the problem is with the Twitter keyword settings:

I get a "Social Network Error" error message because the settings of my Twitter application are not configured for the local host. Make sure your Twitter application has the following settings configured for your local host (development machine):

Callback URL: http://127.0.0.1:8000/

NOTE. . If you want to use it for a production server, you need to install Callback on your domain name as follows:

Callback URL: http://Your_Domain_Name.com

OR it is better to use a different set of keys specifically for use only.

BONUS . If you use django-social-auth and you do not have these settings, you may end up with a 401 Unauthorized error.

+8
source

All Articles