Anyone using Allauth?

312 views
Skip to first unread message

Tom Longson

unread,
Jun 15, 2015, 3:42:22 PM6/15/15
to mezzani...@googlegroups.com
I'm trying to integrate social auth, and looking to make sure there isn't a conflict between mezzanine and allauth.

Thanks,
Tom

Josh Cartmell

unread,
Jun 15, 2015, 11:07:55 PM6/15/15
to mezzani...@googlegroups.com
I haven't used it myself but I don't imagine there would be any conflicts.  Let us know if you run into anything.

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Longson

unread,
Jun 16, 2015, 5:01:16 PM6/16/15
to mezzani...@googlegroups.com
I was able to use django-allauth==0.19.1 successfully do it by disabling Mez accounts in settings.py. Both Facebook and LinkedIn worked fine.

Here are the relevant parts:

AUTHENTICATION_BACKENDS = (
   
#"mezzanine.core.auth_backends.MezzanineBackend",
   
'django.contrib.auth.backends.ModelBackend',
   
# `allauth` specific authentication methods, such as login by e-mail
   
'allauth.account.auth_backends.AuthenticationBackend',
   
)


INSTALLED_APPS
= (
   
"django.contrib.admin",

   
"django.contrib.auth",
   
"django.contrib.contenttypes",
   
"django.contrib.redirects",
   
"django.contrib.sessions",
   
"django.contrib.sites",
   
"django.contrib.sitemaps",
   
"django.contrib.staticfiles",


   
'allauth',
   
'allauth.account',
   
'allauth.socialaccount',
   
'allauth.socialaccount.providers.facebook',
   
'allauth.socialaccount.providers.linkedin_oauth2',


   
"mezzanine.boot",
   
"mezzanine.conf",
   
"mezzanine.core",
   
"mezzanine.generic",
   
"mezzanine.blog",
   
"mezzanine.forms",
   
"mezzanine.pages",
   
"mezzanine.galleries",
   
"mezzanine.twitter",
   
#"mezzanine.accounts",
)


TEMPLATE_CONTEXT_PROCESSORS
= (
   
"django.contrib.auth.context_processors.auth",
   
"django.contrib.messages.context_processors.messages",
   
"django.core.context_processors.debug",
   
"django.core.context_processors.i18n",
   
"django.core.context_processors.static",
   
"django.core.context_processors.media",
   
"django.core.context_processors.request",
   
"django.core.context_processors.tz",
   
"mezzanine.conf.context_processors.settings",
   
"mezzanine.pages.context_processors.page",
   
# `allauth` specific context processors
   
'allauth.account.context_processors.account',
   
'allauth.socialaccount.context_processors.socialaccount',
)


MIDDLEWARE_CLASSES
= (
   
"mezzanine.core.middleware.UpdateCacheMiddleware",
   
"django.contrib.sessions.middleware.SessionMiddleware",
   
"django.middleware.locale.LocaleMiddleware",
   
#"django.contrib.auth.middleware.AuthenticationMiddleware",
   
"django.middleware.common.CommonMiddleware",
   
"django.middleware.csrf.CsrfViewMiddleware",
   
'django.middleware.clickjacking.XFrameOptionsMiddleware',
   
"django.contrib.messages.middleware.MessageMiddleware",

   
"mezzanine.core.request.CurrentRequestMiddleware",
   
"mezzanine.core.middleware.RedirectFallbackMiddleware",
   
"mezzanine.core.middleware.TemplateForDeviceMiddleware",
   
"mezzanine.core.middleware.TemplateForHostMiddleware",
   
"mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
   
"mezzanine.core.middleware.SitePermissionMiddleware",
   
# Uncomment the following if using any of the SSL settings:
   
# "mezzanine.core.middleware.SSLRedirectMiddleware",
   
"mezzanine.pages.middleware.PageMiddleware",
   
"mezzanine.core.middleware.FetchFromCacheMiddleware",
)


SITE_ID
= 1


LOGIN_REDIRECT_URL
= '/'
SOCIALACCOUNT_QUERY_EMAIL
= True
SOCIALACCOUNT_PROVIDERS
= {
   
'facebook': {
       
'SCOPE': ['email'],
       
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
       
'METHOD': 'oauth2',
       
'VERIFIED_EMAIL': False
   
},
   
'linkedin':
     
{'SCOPE': ['r_emailaddress'],
       
'PROFILE_FIELDS': ['id',
                         
'first-name',
                         
'last-name',
                         
'email-address',
                         
'picture-url',
                         
'public-profile-url']
     
}
}
ACCOUNT_DEFAULT_HTTP_PROTOCOL
= 'https'

Reply all
Reply to author
Forward
0 new messages