Django Twitch Auth
Dependencies
Install requests if not installed
pip install requests
Installation
- Install using pip
pip install django_twitch_auth
- Add 'django_twitch_auth' to your INSTALLED_APPS setting.
INSTALLED_APPS = [
...
'django_twitch_auth',
]
- Add 'django_twitch_auth.middlewares.TwitchAuthenticationMiddleware' under 'django.contrib.sessions.middleware.SessionMiddleware' to your MIDDLEWARE setting.
MIDDLEWARE = [
...
'django.contrib.sessions.middleware.SessionMiddleware',
'django_twitch_auth.middlewares.TwitchAuthenticationMiddleware',
...
]
- Add AUTHENTICATION_BACKENDS to your settings.
AUTHENTICATION_BACKENDS = [
'django_twitch_auth.authbackends.TwitchBackend',
]
- Add the following to your root urls.py file.
urlpatterns = [
...
path('django_twitch_auth/', include('django_twitch_auth.urls'))
]
- Add twitch credentials and redirect uri to your settings
TWITCH_CLIENT_ID = 'client_id_here'
TWITCH_CLIENT_SECRET = 'client_secret_here'
TWITCH_REDIRECT_URI = 'https://redirect_uri_here'