S
Supabase3mo ago
xeuzz_

supabase google auth wont get cookies

hey guys GOT DELETED FROM THE REDDIT???? i just ran into this problem and cant fix it myself and refuse to use AI for this project so you are my last resort rn. im building this app with supabase and i'm using the auth services to sign in users using google right, at first i wanted to do it from the server but i was doing it through a button so i couldnt set the onclick property in nextjs with the button as a server component. then i decided to turn the button to a client component and use browserClient for supabase. but now when i call auth.getUser() from server components or routes it never gets the cookies and just returns AuthSessionMissingError so i guess it's because the session only exists on the client's side. but once again i can't sign in the user from the server. i've tried setting the function inside an actions file but that wont work either. if you want to check my code it's hosted
2 Replies
garyaustin
garyaustin3mo ago
You would need to use something like the SSR code to handle cookies between clients. Otherwise you have to handle cookies on your own as supabase-js does not use them. You don't mention your framework or if you are using that.
xeuzz_
xeuzz_OP3mo ago
hi, im using next. i solved the signin in by putting the button inside a form and the handler inside an actions.js and it works, but now i find that i have 9 session tokens in this acc and idk how to expire or revoke them

Did you find this page helpful?