Skip to content

Commit c9ba8c8

Browse files
Merge pull request #3221 from ResearchHub/bug/social-login-failed-for-existing-users
[Bug]: Fix Google social login for existing email users
2 parents 29a7501 + 9cbc49e commit c9ba8c8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/researchhub/settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,14 @@ def silky_capture(request):
427427
SOCIALACCOUNT_EMAIL_VERIFICATION = "none"
428428
SOCIALACCOUNT_EMAIL_REQUIRED = False
429429
SOCIALACCOUNT_QUERY_EMAIL = True
430+
# Let Google sign-ins attach to an existing account when the email matches.
431+
# See: https://docs.allauth.org/en/dev/socialaccount/configuration.html
432+
SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True
433+
SOCIALACCOUNT_PROVIDERS = {
434+
"google": {
435+
"EMAIL_AUTHENTICATION": True,
436+
},
437+
}
430438

431439

432440
GOOGLE_REDIRECT_URL = "http://localhost:8000/auth/google/login/callback/"

0 commit comments

Comments
 (0)