Clemens
TTCTheo's Typesafe Cult
•Created by Clemens on 3/23/2025 in #questions
How to properly add Google Sign In to existing application that has email login implemented already?
Thank you so much for your detailed answer! I did something similar that seems to work but after thinking about it, there are some more questions:
Backend verifies the token from Google (super important!), then gets the user's Google ID (sub) and email.I'm using the t3 Stack with NextAuth preconfigured. I assume that NextAuth does the verification automatically, right?
Also add a googleId field (unique) to link accountsInteresting, I completely forgot to think about what happens when a users google email changes. I simply took the email address as identifier for google users but now that Im googling a bit it seems that this can change. Will use a googleId as suggested 👍 Do you usually need to handle if the Google users email changes? I think I simply won't handle that for the time being in my small web app but that seems like something I could do in the future. Like you said I now redirect the google users after first sign in to a username setting page. In the backend I set up specific protected procedures to make sure Google Sign In users can not do stuff like changing email, address, setting a password and so on. And I also use the protected procedure to stop email sign in users from setting a username. Looks like this:
5 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 2/27/2025 in #questions
How to fire mutation with url query param only once
https://github.com/trojanowski/react-apollo-hooks/issues/205#issuecomment-1032336686
found a solution here. sneaky one
4 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
I'm just confused that it is so hard to just set an own query key
7 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
It just feels wrong to directly set a queryHash. Maybe I could also write a custom queryHashFn 🤔
7 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
Good question. I have multiple queries that only differ by
to
.
All in all, I think it makes most sense to simple set a custom query key for each query.
queryKey
is typed so that it only allows the predefined queryKey with the query parameters.
I think what I would prefer to do would be to be able to pass a custom queryKey instead of the predefined ["router.getTotalPosts", { from, to}]
] (changing the router.getTotalPosts
is not possible due to the typing7 replies