Last active
August 29, 2015 14:25
-
-
Save JJediny/a453dd84713f78419c2a to your computer and use it in GitHub Desktop.
local_settings.py for enabling python-social-auth in Geonode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Only reflects the additional settings needed within local_settings.py file | |
""" | |
#INSTALLED_APPS = ( | |
#python-social-auth | |
'social.apps.django_app.default', | |
#TEMPLATE_CONTEXT_PROCESSORS = ( | |
# Python Social Auth | |
'social.apps.django_app.context_processors.backends', | |
'social.apps.django_app.context_processors.login_redirect', | |
#AUTHENTICATION_BACKENDS = ( | |
# Python Social Auth | |
#'social.backends.facebook.FacebookOAuth2', | |
'social.backends.github.GithubOAuth2', | |
'social.backends.google.GoogleOAuth2', | |
'social.backends.linkedin.LinkedinOAuth2', | |
#'social.backends.twitter.TwitterOAuth', | |
'guardian.backends.ObjectPermissionBackend', | |
'django.contrib.auth.backends.ModelBackend', | |
# Python Social Auth | |
LOGIN_REDIRECT_URL = '/' | |
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy' | |
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage' | |
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['username', 'first_name', 'last_name', 'email'] | |
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True | |
SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u) | |
SOCIAL_AUTH_DISCONNECT_REDIRECT_URL = '/account-disconnected-redirect-url/' | |
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/' | |
SOCIAL_AUTH_LOGIN_ERROR_URL = '/login-error/' | |
SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/" | |
SOCIAL_AUTH_LOGIN_URL = '/login-url/' | |
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/new-association-redirect-url/' | |
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/' | |
SOCIAL_AUTH_PIPELINE = ( | |
'social.pipeline.social_auth.social_details', | |
'social.pipeline.social_auth.social_uid', | |
'social.pipeline.social_auth.auth_allowed', | |
'social.pipeline.social_auth.social_user', | |
'social.pipeline.user.get_username', | |
'social.pipeline.social_auth.associate_by_email', | |
'social.pipeline.user.create_user', | |
'social.pipeline.social_auth.associate_user', | |
'social.pipeline.social_auth.load_extra_data', | |
'social.pipeline.user.user_details' | |
) | |
#Github | |
# https://developer.github.com/ | |
SOCIAL_AUTH_USER_MODEL = 'people.Profile' | |
SOCIAL_AUTH_GITHUB_KEY = '' | |
SOCIAL_AUTH_GITHUB_SECRET = '' | |
SOCIAL_AUTH_GITHUB_SCOPE = ["user:email", ] | |
GITHUB_API_SECRET = '' | |
# http://code.google.com/apis/accounts/docs/OAuth2.html | |
# http://code.google.com/apis/gdata/docs/directory.html | |
# When creating the application in the Google Console be sure to fill the PRODUCT NAME at API & auth $ | |
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = u'' | |
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = u'' | |
SOCIAL_AUTH_GOOGLE_OAUTH2_USE_DEPRECATED_API = True | |
# Linked-in | |
# http://developer.linkedin.com/documents/authentication | |
# https://www.linkedin.com/secure/developer | |
SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = '' | |
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = '' | |
SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE = ['r_basicprofile', 'r_emailaddress', ] | |
# Add the fields so they will be requested from linkedin. | |
SOCIAL_AUTH_LINKEDIN_OAUTH2_FIELD_SELECTORS = ['email-address', 'headline', 'industry'] | |
# Arrange to add the fields to UserSocialAuth.extra_data | |
SOCIAL_AUTH_LINKEDIN_OAUTH2_EXTRA_DATA = [('id', 'id'), | |
('firstName', 'first_name'), | |
('lastName', 'last_name'), | |
('emailAddress', 'email_address'), | |
('headline', 'headline'), | |
('industry', 'industry')] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment