Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

fix: going back to using auth headers for SupabaseQueryBuilder #192

Merged
merged 5 commits into from Apr 30, 2023

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Currently, when user performs an query right after signing in, the query is performed with the session prior to signing in, resulting in empty query result. This PR fixes that.

await client.auth.signInWithPassword(email: email, password: password);

/// Unable to retrieve data if the data is protected with RLS
final data = await client
    .from('profiles')
    .select()
    .eq('user_id', response.user?.id);

Fixes supabase/supabase-flutter#456

@dshukertjr dshukertjr changed the title going back to using auth headers for SupabaseQueryBuilder fix: going back to using auth headers for SupabaseQueryBuilder Apr 28, 2023
@bdlukaa
Copy link
Contributor

bdlukaa commented Apr 28, 2023

Can't we have both auth and other headers?

@Vinzent03
Copy link
Contributor

The problem itself though persists with storage and functions client. I think a possibility is making the onAuthStateChanged stream sync, so that the listener is instantly called. I think that would be fine with our own listener, but I don't know the consequences for the listeners in the users application. Maybe we add two streams? One async and one sync?

@dshukertjr
Copy link
Member Author

dshukertjr commented Apr 29, 2023

@Vinzent03
Although the problem persists with storage and functions client, the postgrest client is by far the most commonly used right after sining in. Let's ship a fix for this particular use case and discuss how to properly handle it for storage and functions client.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sometimes requires two queries to Profile table
3 participants