realtime-py
realtime-py copied to clipboard
ANON-KEY not working on change notification
Bug report
Describe the bug
Follow demo step, as
from realtime.connection import Socket
SUPABASE_ID = "dlzlllxhaakqdmaapvji"
API_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MT"
def callback1(payload):
print("Callback 1: ", payload)
if __name__ == "__main__":
URL = f"wss://{SUPABASE_ID}.supabase.co/realtime/v1/websocket?apikey={API_KEY}&vsn=1.0.0"
s = Socket(URL)
s.connect()
channel_1 = s.set_channel("realtime:*")
channel_1.join().on("UPDATE", callback1)
s.listen()
When API_KEY refers to Supabase secret service key, it works as expected. But when API_KEY refers to ANON Key, it does not work at all -- code runs without compliant but cannot receive notification when change happened in table , even with access authorized by RLS on table.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- use demo code.
- toggle API_KEY between ANON_KEY and SERVICE_KEY.
- then change something in supabase table.
- check difference.
Expected behavior
ANON-KEY , or with authenticated role should receive change notification as SERVICE_KEY.
Hope the document make it clear on authorization method used in this client, and also how RLS could be integrated.
I faced the same problem with the anon key for real-time data listen. Still, they haven't fixed that problem.