supabase/auth-py

Google Auth not working

ZacBytes opened this issue · 4 comments

supabase.auth.user() returns null even after successful login with Google provider

J0 commented

Transferring to gotrue-py

J0 commented

I thought about this further and realised that this is rather awkward to support because Python doesn't have direct access to browser cookies where the access tokens are stored after provider login.

Currently, after making a successful authentication the provider (in this case Google) makes a callback to Supabase Auth which in turn sets a few cookies on localStorage and redirects to the provided URI. This is fine in the js lib we can interact with the browser and grab the tokens from the cookies set there

However, in Python the default backing storage is a dictionary and Python won't access the cookies which are in localStorage.

Will think further about this but am open to suggestions

I ended up using JS to grab the anchor tag value from the URL and pass it to the python server.

J0 commented

@ZacBytes thanks for the swift reply! Glad to hear that you managed to find a workaround.
Was just chatting with the team and I think it's unlikely that one will probably need to set the access-token-cookie client side or grab the access-token client side for now as per the server side guide

It'll probably be a smoother experience once we switch to the pkce flow

Going to close this issue for now but feel free to re-open if there are any issues or concerns