python - Using django-allauth I am unable to log in with Twitch -
python - Using django-allauth I am unable to log in with Twitch -
update - got allauth working google next same steps tried twitch.
first off i'm quite new programming anything. first project outside of tutorials.
i'm trying utilize django-allauth log in using twitch. i'm starting project using coockiecutter-django sets django-allauth automatically, without social authentication set up. can log in fine business relationship made on site.
after adding 'allauth.socialaccount.providers.twitch', installed_apps, twitch link appears on log in page. registered app @ http://www.twitch.tv/kraken/oauth2/clients/new , copied admin social application page.
after clicking on twitch log in link, next error:
environment: request method: request url: http://127.0.0.1:8000/accounts/twitch/login/callback/?code=8lhhsf461v7ksw0no3ajlwfslbdtia&scope=&state=xxke31qcbow2 django version: 1.7.1 python version: 2.7.6 installed applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'crispy_forms', 'avatar', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.twitch', 'users', 'debug_toolbar') installed middleware: ('djangosecure.middleware.securitymiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'debug_toolbar.middleware.debugtoolbarmiddleware') traceback: file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 111. response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/allauth/socialaccount/providers/oauth2/views.py" in view 53. homecoming self.dispatch(request, *args, **kwargs) file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/allauth/socialaccount/providers/oauth2/views.py" in dispatch 102. response=access_token) file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/allauth/socialaccount/providers/twitch/views.py" in complete_login 21. extra_data) file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/allauth/socialaccount/providers/base.py" in sociallogin_from_response 45. uid = self.extract_uid(response) file "/home/brian/envs/trycookie/local/lib/python2.7/site-packages/allauth/socialaccount/providers/twitch/provider.py" in extract_uid 25. homecoming str(data['_id']) exception type: keyerror @ /accounts/twitch/login/callback/ exception value: '_id'
i'll seek provide in project code think relevant. if i'm forgetting please allow me know.
settings.py (renamed common.py in coockiecutter-django)
installed_apps = ( 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.twitch', ) template_context_processors = ( 'django.core.context_processors.request', "allauth.account.context_processors.account", "allauth.socialaccount.context_processors.socialaccount", ) authentication_backends = ( "django.contrib.auth.backends.modelbackend", "allauth.account.auth_backends.authenticationbackend", ) site_id = 1 account_authentication_method = "username" account_email_required = true account_email_verification = "mandatory" auth_user_model = "users.user" login_redirect_url = "users:redirect" login_url = "account_login"
urls.py
url(r'^users/', include("users.urls", namespace="users")), url(r'^accounts/', include('allauth.urls')),
all info in twitch registration page , admin page should matched up. copy/pasted , checked several times. removing info , entering again.
you need add together user_read
scope callback request contains _id
parameter
add settings.py
socialaccount_providers = { "twitch": {"scope": ["user_read"]}, }
python django authentication django-allauth twitch
Comments
Post a Comment