Skip to content

Instantly share code, notes, and snippets.

@pyaf
Last active March 24, 2017 16:44
Show Gist options
  • Save pyaf/807a3cfdb9b0e9520a2a228ad26e03c5 to your computer and use it in GitHub Desktop.
Save pyaf/807a3cfdb9b0e9520a2a228ad26e03c5 to your computer and use it in GitHub Desktop.
AUTHENTICATION_BACKENDS = (
...
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
...
)
INSTALLED_APPS = (
...
'django.contrib.auth',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.twitter',
...
)
SITE_ID = 1
LOGIN_REDIRECT_URL = "/dashboard/"
SOCIALACCOUNT_PROVIDERS = {
'facebook': {
'METHOD': 'oauth2',
'SCOPE': ['email', 'public_profile'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'FIELDS': [
'id',
'email',
'name',
'first_name',
'last_name',
'verified',
'locale',
'timezone',
'link',
'gender',
'updated_time',
],
'EXCHANGE_TOKEN': True,
'VERIFIED_EMAIL': False,
'VERSION': 'v2.4',
}
}
#urls.py
urlpatterns = [
...
url(r'^accounts/', include('allauth.urls')),
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment