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

ANON-KEY not working on change notification #63

Open
qishansun opened this issue May 1, 2023 · 1 comment
Open

ANON-KEY not working on change notification #63

qishansun opened this issue May 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@qishansun
Copy link

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:

  1. use demo code.
  2. toggle API_KEY between ANON_KEY and SERVICE_KEY.
  3. then change something in supabase table.
  4. 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.

@qishansun qishansun added the bug Something isn't working label May 1, 2023
@FayzulSaimun
Copy link

I faced the same problem with the anon key for real-time data listen. Still, they haven't fixed that problem.

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

2 participants