Skip to content
Back

[SOLVED] Google Auth not working in a React/TanStack Start App

  • 0
  • Resolved
  • 5
  • Web
  • Cloud
David
13 Dec, 2025, 13:43

Authentication with Google has failed. It redirects back to the signin route in React. Attached screenshots for configuration of Google console and Appwrite Google Auth configuration.

Here is the link to the repo.

https://github.com/davidofug/google-auth-with-appwrite

@Steven please help

TL;DR
Google Auth issue in a React/TanStack Start App was resolved by enabling third party cookies and using a custom domain. The code snippet in `auth.jsx` needed to be adjusted. The ultimate solution was to set a custom domain. Testing in different browsers revealed that Firefox was blocking cookies, which was resolved by disabling site protection features and removing ad blockers. Using a custom domain resolved the issue in production, but not in a developer environment.
13 Dec, 2025, 16:50

Avoid pinging core members πŸ˜…

1
13 Dec, 2025, 16:53

Hey! Thanks for telling that. I did this sometimes when I felt like I couldn't find solution for the user's issues or when any issue seems urgentπŸ˜…

1
13 Dec, 2025, 16:55

This one is not urgent

1
13 Dec, 2025, 16:57

Yes I know. I was talking about earlier incidents, definitely not this one

13 Dec, 2025, 16:58

<@810214718702616606> Try enabling third party cookies as it looks like your browser is blocking some of the requests

13 Dec, 2025, 16:58

Also, we need the console network logs for further debugging. Make suer to censor all the sensitive tokens, IDs, etc

13 Dec, 2025, 17:01

Yes <@810214718702616606> , Also make sure you properly hide your email IDs (if you don't want them to be disclosed) in your videos.

1
13 Dec, 2025, 17:04

Also, I've checked your code. And I've a suggesstion. Here, in this part in auth.jsx: ```await account.createOAuth2Session( "google", ${window.location.origin}/oauth-callback, ${window.location.origin}/failed );

TypeScript
Can you try changing `${window.location.origin}/oauth-callback` to `window.location.origin`
13 Dec, 2025, 17:06

If that too won't work. Try directly using http://localhost:5173

13 Dec, 2025, 17:25

90% its third party cookies related issue Cause as soon as login occurs, the missing user role error is there. <@810214718702616606>
https://appwrite.io/blog/post/fixing-oauth2-issues-in-appwrite-cloud Try reading the details and implementing what is written.

13 Dec, 2025, 19:25

Thank you for the warning πŸ™Œ

13 Dec, 2025, 19:33

Looks like none of these worked!

13 Dec, 2025, 19:42

Then it must be the browser blocking your requests as D5 & Axistro mentioned

13 Dec, 2025, 19:46

I supposed brave blocks the cookies but I doubt if Firefox is also blocking the cookies. Let me try the option recommended by <@1276628406288519234>

1
14 Dec, 2025, 03:44

its not just these browsers blocks these but most browser have a third party cookies policy (to save you) Although in browsers like brave it will still clear the cookies created by the new method suggested in the blog. But you should still be able to keep logged in until you close the site. but it wont get cleared in chrome. so you can test there. the final and solid solution is to have custom domain.

1
14 Dec, 2025, 07:19

I have set the custom domain. But when I am localhost will it work?

14 Dec, 2025, 07:21

You will be able to keep signed in untill you keep the site open(for brave) Other browsers should keep the sessions. As for the localhost, it will still act like third party as domains dont match. (Should work fine on production)

14 Dec, 2025, 14:16

jst today, worked fixing the oauth.. 4hrs jst to realise firefox blocked the cookies.

14 Dec, 2025, 14:24

Did you resolve the issue? After following everything, it logged in once then it started failing again. I have tried firefox, safari and firefox

14 Dec, 2025, 14:27

is the issue same as before or if you close the site , you have to login again?

14 Dec, 2025, 14:28

turned off the site protection feature on firefox.

14 Dec, 2025, 14:28

removed ublockorigin

14 Dec, 2025, 14:28

then it worked, but then tried again in chrome with default settings. it worked.

14 Dec, 2025, 14:28

no changes to the code

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more