Skip to content

supabase-py does not handle the new API keys (secret keys sb_secret_, not JWT based) #1150

Open
@clauverjat-h

Description

@clauverjat-h

Bug report

  • I confirm this is a bug with supabase-py, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions.

Describe the bug

supabase-py does not support the new API keys (https://github.com/orgs/supabase/discussions/29260).

In the SyncClient, this is caused by the following lines :

# Check if the key is a valid JWT
if not re.match(
r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", supabase_key
):
raise SupabaseException("Invalid API key")

Those explicitly check the supabase_key provided is a JWT and raise an exception stating the key is invalid if it is not.
Removing this check is enough to render ClientSync compatible. We do that via Monkeypatching in our codebase. Alternatively one might just change the check to also allow supabase_key starting with sb_secret_ in addition the old JWT based keys.

Metadata

Metadata

Assignees

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