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

Python realtime with RLS #86

Open
TomasRences opened this issue Jan 31, 2024 · 2 comments
Open

Python realtime with RLS #86

TomasRences opened this issue Jan 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@TomasRences
Copy link

Bug report

Describe the bug

Unable to catch event if policy checking if user is authentificated exists on table.

To Reproduce

Python client code:

from realtime.connection import Socket

SUPABASE_URL = "project_id"
SUPABASE_KEY = "anon_key"

realtime_url = f"wss://{SUPABASE_URL}/realtime/v1/websocket?apikey={SUPABASE_KEY}"


def callback(event):
    print(event)


s = Socket(realtime_url)
s.connect()

channel = s.set_channel("realtime:*")
channel.join().on("*", callback)
s.listen()

It is work for public tables, but when we want to enable RLS and allow to CRUD only for authentificated users with following policy:

CREATE POLICY "User Is Authentificated" ON "public"."myTable"
AS PERMISSIVE FOR ALL
TO authenticated
USING (true)

Expected behavior

Be able to authentificate with Bearer JWT token as user

System information

  • Version of realtime-py: 1.0.2
@TomasRences TomasRences added the bug Something isn't working label Jan 31, 2024
@VisionOra
Copy link

VisionOra commented Apr 3, 2024

PLease fix this

@fullstackwebdev
Copy link

is this why I am only getting INSERTs (public info) but not UPDATES (I guess RLS forbids these events?), even I am using SERVICE ROLE KEY?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants