supabase / auth-helpers

A collection of framework specific Auth utilities for working with Supabase.
https://supabase.github.io/auth-helpers/
MIT License
893 stars 240 forks source link

the cookies option doesn't seem to be doing anything #721

Closed JorensM closed 1 month ago

JorensM commented 5 months ago

Bug report

Describe the bug

Setting the CRUD functions for the cookies option doesn't seem to be doing anything. The functions never get called.

To Reproduce

supabase cookies option

In this code I posted you can see that I've simply added console.logs to the setter/getter/remover. Yet the console never logs any of those messages. I should also note that I'm using a custom storage handler in the auth option. I should also say that I know that the Supabase client uses the auth storage to store cookies. Which then begs the question: why do we have a separate cookie CRUD object if it's not being used? Currently TypeScript says that this property is required, which seems redundant considering that the client is using the storage defined in auth to manage cookies, and considering that the getters/setters never get called anyway. I'd expect at the very least for the cookies property not to be required.

Expected behavior

I'd expect for either:

a) the cookies functions to be called b) the cookies property to be optional

Screenshots

See screenshot of my Supabase config above.

System information

Additional context

I'm moving away from supabase/ssr because I found out that it only uses cookies for storing the session and doesn't offer any alternatives, which won't work for me because I'm writing an app with React Native, which doesn't support cookies. But just thought I'd share this small bug with you.

KyleFontenot commented 3 months ago

I'm pretty confident get, set, and remove should be synchronous instead of async. If you remove async do you still get the same results?

hf commented 1 month ago

This is expected. createServer/BrowserClient implement their own storage option. So if you already set your own, your custom option (AsyncStorage) wins.