Skip to content

Fix Google sign-in failure when Firestore user document is missing#6

Open
rahul810050 wants to merge 1 commit intooaiedu:masterfrom
rahul810050:fix/google-signin-missing-user-doc
Open

Fix Google sign-in failure when Firestore user document is missing#6
rahul810050 wants to merge 1 commit intooaiedu:masterfrom
rahul810050:fix/google-signin-missing-user-doc

Conversation

@rahul810050
Copy link

Fixed issue: #5

Summary

This PR fixes a Google authentication issue where sign-in fails if the corresponding Firestore user document does not yet exist.

Details

  • Firebase Authentication successfully creates the user
  • Firestore does not automatically create a /users/{uid} document
  • The existing Google sign-in flow attempted to call update() on a non-existent document, causing a runtime error

Changes

  • Replaced unsafe Firestore update() calls with set(..., { merge: true }) in the Google sign-in flow
  • Ensures user documents are created automatically on first Google login
  • Safely updates existing user records on subsequent logins

Impact

  • Google sign-in now works reliably for both new and returning users
  • No breaking changes
  • No behavior changes for email/password authentication

Signed-off-by: rahul810050 <rahul810050@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant