Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in with Google #243

Merged
merged 8 commits into from
Jun 15, 2024
Merged

Log in with Google #243

merged 8 commits into from
Jun 15, 2024

Conversation

owenchen04
Copy link
Contributor

@owenchen04 owenchen04 commented Apr 22, 2024

Summary

Allowed users to create an account and sign-in using the 'Continue with Google' button. The flow is the same regardless of whether they are using Google to log in for the first time or they are a returning user.

Testing

Manually tested by using my personal Google account. Made sure that in both cases (first time signing in vs. returning user), continue with Google worked as expected (creating a user in the local database in the former case). Also used console.log to ensure that the created firebase user had emailVerified already set to true.

Notes

I was having issues using the react-firebase-hooks useSignInWithGoogle hook, as the googleUser object returned by the hook was always undefined. Instead, I followed the official firebase documentation. While the flow seems fine for now, there is a possibility that there are errors I couldn't account for.

Closes #236

@owenchen04 owenchen04 requested a review from jasozh as a code owner April 22, 2024 03:36
Copy link

vercel bot commented Apr 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lagos-volunteers ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2024 5:21am

Copy link
Member

@akinfelami akinfelami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi guys!

Nice work on this. I tested it and it works fine! However, I noticed some things that will need your attention. Please see my comments

backend/src/users/views.ts Outdated Show resolved Hide resolved
frontend/src/components/organisms/LoginForm.tsx Outdated Show resolved Hide resolved
frontend/src/components/organisms/LoginForm.tsx Outdated Show resolved Hide resolved
frontend/src/components/organisms/LoginForm.tsx Outdated Show resolved Hide resolved
// console.log("creating user");
await createLocalUserFromGoogle.mutateAsync({userid, firstName, lastName, email, phoneNumber});
} else {
// console.log("user already created");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 you're missing this else case

@jasozh
Copy link
Contributor

jasozh commented Jun 14, 2024

Thinking about potential issues:

  • User creates email/password account then Google account. No issue here, the Google account automatically links to the email/password account in Firebase. ISSUE: "Your account already exists. Please log in using your email and password." error never triggers. Consider removing? Having an automatic link is desired behavior imo. UPDATE: removed issue.
  1. User creates Google account thatn email/password account. Resetting their password is the only way to change their password (to create an email/password account), and doing so also replaces their Google account in Firebase with email/password. But not user-facing issue, because signing into Google automatically links their accounts again. So maybe a non-issue?

New additions

  • In Profile, add button to add email/password to accounts that only have Google sign-in.

@jasozh jasozh merged commit 66ca706 into main Jun 15, 2024
1 of 5 checks passed
@jasozh jasozh deleted the login-google-fullstack branch June 15, 2024 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved @jason it's good to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log in with Google (fullstack)
3 participants