Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to provide a fix for the RLS syncing issue. (Sourcery refactored) #531

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion supabase/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

See the `table` method.
"""
return self.postgrest.from_(table_name)
return self.postgrest.from_(table_name, self._get_auth_token())

Check warning on line 108 in supabase/client.py

View check run for this annotation

Codecov / codecov/patch

supabase/client.py#L108

Added line #L108 was not covered by tests

def rpc(self, fn: str, params: Dict[Any, Any]) -> SyncFilterRequestBuilder:
"""Performs a stored procedure call.
Expand Down Expand Up @@ -197,6 +197,11 @@
client.auth(token=supabase_key)
return client

def _get_auth_token(self) -> str:
"""Helper method to get the auth token."""
session = self.auth.get_session()
return self.supabase_key if session is None else session.access_token

Check warning on line 203 in supabase/client.py

View check run for this annotation

Codecov / codecov/patch

supabase/client.py#L202-L203

Added lines #L202 - L203 were not covered by tests

def _get_auth_headers(self) -> Dict[str, str]:
"""Helper method to get auth headers."""
# What's the corresponding method to get the token
Expand Down
Loading