Enable social-auth locally (updated)
Go to Google developer console, make a new Project and enable 'Google+API' service
Go to the 'Credentials' and Add the following:
1. Add the local root url of your service as 'Authorized Javascript Origin' Example: http://localhost:18000 ( in case of lms ) 2. Add the 'Authorized redirect URI' Example: http://localhost:18000/auth/complete/google-oauth2/ ( in case of lms ) 3. Click 'Save'
Create/extend the 'private.py' by the following:
from .common import FEATURES, AUTHENTICATION_BACKENDS FEATURES['ENABLE_THIRD_PARTY_AUTH'] = True THIRD_PARTY_AUTH = { "Google": { "SOCIAL_AUTH_GOOGLE_OAUTH2_KEY":"{client ID}", "SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET":"{client secret}" } } THIRD_PARTY_AUTH_BACKENDS = [ 'social_core.backends.google.GoogleOAuth2', ] AUTHENTICATION_BACKENDS += THIRD_PARTY_AUTH_BACKENDS
Configure the google-oauth2 third_party_auth backend by either going inserting in the SQL database:
INSERT INTO third_party_auth_oauth2providerconfig VALUES ('1', '2015-07-01 18:29:39.000000', '1', 'fa-google-plus', 'Google', '0', '0', '0', 'google-oauth2', '{client ID}', '{client secret}', '{}', NULL, '', '1', 'google-oauth2', '1');
OR via Django Admin
1. Go to http://localhost:18000/admin/third_party_auth/oauth2providerconfig/add/ 2. Select "Enabled" 3. Set "Icon class" to fa-google-plus 4. Set "Name" to 'Google' 5. Set "Slug" to 'google-oauth2' 6. Select "Visible" 7. Set "Backend Name" to 'google-oauth2' 8. Set "Client ID" to {client ID} 9. Set "Client Secret" to {client secret} 10. Click "Save"
- Restart all the services
Note: Replace 'client ID' and 'client secret' from the credentials of the google console project.