Enable social-auth locally

  1. Go to Google developer console, make a new Project and enable 'Google+API' service
  2. Go to the 'Credentials' and Add the following:
    • Add the local root url of your service as 'Authorized Javascript Origin' 
      • Example: http://localhost:8000 ( in case of lms )
    • Add the 'Authorized redirect URI' 
      • Example: http://localhost:8000/auth/complete/google-oauth2// ( in case of lms )
    • Click 'Save'
  3. Create/extend the 'private.py' by the following:
    • from django.conf import settings

      settings.FEATURES['ENABLE_THIRD_PARTY_AUTH'] = True
      settings.AUTH_TOKENS['THIRD_PARTY_AUTH'] = {
      "Google": {
      "SOCIAL_AUTH_GOOGLE_OAUTH2_KEY":"{client ID}",
      "SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET":"{client secret}"
       }
      }
  4. Execute the following command on local mysql db:
    • 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');
  5. Restart all the services
    Note: Replace 'client ID' and 'client secret' from the credentials of the google console project.