Skip to content

Python realtime with RLS #86

Open
Open
@TomasRences

Description

@TomasRences

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions