prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Social Network Login Failure
  When clicking on connect GitHub on the [social accounts page](https://readthedocs.org/accounts/social/connections/?) I get a message:
  
  > An error occurred while attempting to login via your social network account.
  
  There's a `?` in the url. Could that be a hint? Is it missing some request arguments? If I omit it, the bug persists.
  
  Cheers!
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `readthedocs/settings/postgres.py`
  Content:
  ```
  1 import os
  2 
  3 from .base import *  # noqa
  4 
  5 
  6 DATABASES = {
  7     'default': {
  8         'ENGINE': 'django.db.backends.postgresql_psycopg2',
  9         'NAME': 'docs',
  10         'USER': 'postgres',  # Not used with sqlite3.
  11         'PASSWORD': '',
  12         'HOST': '10.177.73.97',
  13         'PORT': '',
  14     }
  15 }
  16 
  17 DEBUG = False
  18 TEMPLATE_DEBUG = False
  19 CELERY_ALWAYS_EAGER = False
  20 
  21 MEDIA_URL = 'https://media.readthedocs.org/'
  22 STATIC_URL = 'https://media.readthedocs.org/static/'
  23 ADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'
  24 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
  25 
  26 HAYSTACK_CONNECTIONS = {
  27     'default': {
  28         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
  29         'URL': 'http://odin:8983/solr',
  30     }
  31 }
  32 
  33 CACHES = {
  34     'default': {
  35         'BACKEND': 'redis_cache.RedisCache',
  36         'LOCATION': 'localhost:6379',
  37         'PREFIX': 'docs',
  38         'OPTIONS': {
  39             'DB': 1,
  40             'PARSER_CLASS': 'redis.connection.HiredisParser'
  41         },
  42     },
  43 }
  44 
  45 # Elasticsearch settings.
  46 ES_HOSTS = ['backup:9200', 'db:9200']
  47 ES_DEFAULT_NUM_REPLICAS = 1
  48 ES_DEFAULT_NUM_SHARDS = 5
  49 
  50 SLUMBER_API_HOST = 'https://readthedocs.org'
  51 WEBSOCKET_HOST = 'websocket.readthedocs.org:8088'
  52 
  53 PRODUCTION_DOMAIN = 'readthedocs.org'
  54 USE_SUBDOMAIN = True
  55 NGINX_X_ACCEL_REDIRECT = True
  56 
  57 SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
  58 
  59 # Lock builds for 10 minutes
  60 REPO_LOCK_SECONDS = 300
  61 
  62 # Don't re-confirm existing accounts
  63 ACCOUNT_EMAIL_VERIFICATION = 'none'
  64 
  65 FILE_SYNCER = 'privacy.backends.syncers.DoubleRemotePuller'
  66 
  67 # set GitHub scope
  68 SOCIALACCOUNT_PROVIDERS = {
  69     'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}
  70 }
  71 
  72 if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):
  73     try:
  74         from local_settings import *  # noqa
  75     except ImportError:
  76         pass
  77
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/readthedocs/settings/postgres.py b/readthedocs/settings/postgres.py
  --- a/readthedocs/settings/postgres.py
  +++ b/readthedocs/settings/postgres.py
  @@ -69,6 +69,9 @@
       'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}
   }
   
  +# allauth settings
  +ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
  +
   if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):
       try:
           from local_settings import *  # noqa
  
verification_info: {"golden_diff": "diff --git a/readthedocs/settings/postgres.py b/readthedocs/settings/postgres.py\n--- a/readthedocs/settings/postgres.py\n+++ b/readthedocs/settings/postgres.py\n@@ -69,6 +69,9 @@\n     'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}\n }\n \n+# allauth settings\n+ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'\n+\n if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):\n     try:\n         from local_settings import *  # noqa\n", "issue": "Social Network Login Failure\nWhen clicking on connect GitHub on the [social accounts page](https://readthedocs.org/accounts/social/connections/?) I get a message:\n\n> An error occurred while attempting to login via your social network account.\n\nThere's a `?` in the url. Could that be a hint? Is it missing some request arguments? If I omit it, the bug persists.\n\nCheers!\n\n", "before_files": [{"content": "import os\n\nfrom .base import *  # noqa\n\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'docs',\n        'USER': 'postgres',  # Not used with sqlite3.\n        'PASSWORD': '',\n        'HOST': '10.177.73.97',\n        'PORT': '',\n    }\n}\n\nDEBUG = False\nTEMPLATE_DEBUG = False\nCELERY_ALWAYS_EAGER = False\n\nMEDIA_URL = 'https://media.readthedocs.org/'\nSTATIC_URL = 'https://media.readthedocs.org/static/'\nADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'\nSESSION_ENGINE = \"django.contrib.sessions.backends.cached_db\"\n\nHAYSTACK_CONNECTIONS = {\n    'default': {\n        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',\n        'URL': 'http://odin:8983/solr',\n    }\n}\n\nCACHES = {\n    'default': {\n        'BACKEND': 'redis_cache.RedisCache',\n        'LOCATION': 'localhost:6379',\n        'PREFIX': 'docs',\n        'OPTIONS': {\n            'DB': 1,\n            'PARSER_CLASS': 'redis.connection.HiredisParser'\n        },\n    },\n}\n\n# Elasticsearch settings.\nES_HOSTS = ['backup:9200', 'db:9200']\nES_DEFAULT_NUM_REPLICAS = 1\nES_DEFAULT_NUM_SHARDS = 5\n\nSLUMBER_API_HOST = 'https://readthedocs.org'\nWEBSOCKET_HOST = 'websocket.readthedocs.org:8088'\n\nPRODUCTION_DOMAIN = 'readthedocs.org'\nUSE_SUBDOMAIN = True\nNGINX_X_ACCEL_REDIRECT = True\n\nSECURE_PROXY_SSL_HEADER = (\"HTTP_X_FORWARDED_PROTO\", \"https\")\n\n# Lock builds for 10 minutes\nREPO_LOCK_SECONDS = 300\n\n# Don't re-confirm existing accounts\nACCOUNT_EMAIL_VERIFICATION = 'none'\n\nFILE_SYNCER = 'privacy.backends.syncers.DoubleRemotePuller'\n\n# set GitHub scope\nSOCIALACCOUNT_PROVIDERS = {\n    'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}\n}\n\nif not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):\n    try:\n        from local_settings import *  # noqa\n    except ImportError:\n        pass\n", "path": "readthedocs/settings/postgres.py"}], "after_files": [{"content": "import os\n\nfrom .base import *  # noqa\n\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'docs',\n        'USER': 'postgres',  # Not used with sqlite3.\n        'PASSWORD': '',\n        'HOST': '10.177.73.97',\n        'PORT': '',\n    }\n}\n\nDEBUG = False\nTEMPLATE_DEBUG = False\nCELERY_ALWAYS_EAGER = False\n\nMEDIA_URL = 'https://media.readthedocs.org/'\nSTATIC_URL = 'https://media.readthedocs.org/static/'\nADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'\nSESSION_ENGINE = \"django.contrib.sessions.backends.cached_db\"\n\nHAYSTACK_CONNECTIONS = {\n    'default': {\n        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',\n        'URL': 'http://odin:8983/solr',\n    }\n}\n\nCACHES = {\n    'default': {\n        'BACKEND': 'redis_cache.RedisCache',\n        'LOCATION': 'localhost:6379',\n        'PREFIX': 'docs',\n        'OPTIONS': {\n            'DB': 1,\n            'PARSER_CLASS': 'redis.connection.HiredisParser'\n        },\n    },\n}\n\n# Elasticsearch settings.\nES_HOSTS = ['backup:9200', 'db:9200']\nES_DEFAULT_NUM_REPLICAS = 1\nES_DEFAULT_NUM_SHARDS = 5\n\nSLUMBER_API_HOST = 'https://readthedocs.org'\nWEBSOCKET_HOST = 'websocket.readthedocs.org:8088'\n\nPRODUCTION_DOMAIN = 'readthedocs.org'\nUSE_SUBDOMAIN = True\nNGINX_X_ACCEL_REDIRECT = True\n\nSECURE_PROXY_SSL_HEADER = (\"HTTP_X_FORWARDED_PROTO\", \"https\")\n\n# Lock builds for 10 minutes\nREPO_LOCK_SECONDS = 300\n\n# Don't re-confirm existing accounts\nACCOUNT_EMAIL_VERIFICATION = 'none'\n\nFILE_SYNCER = 'privacy.backends.syncers.DoubleRemotePuller'\n\n# set GitHub scope\nSOCIALACCOUNT_PROVIDERS = {\n    'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}\n}\n\n# allauth settings\nACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'\n\nif not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):\n    try:\n        from local_settings import *  # noqa\n    except ImportError:\n        pass\n", "path": "readthedocs/settings/postgres.py"}]}