- Standard Supabase Auth
-
Anonymous Sign-Ins
- JavaScript Example
- Fully custom auth
- Experimental: We’ve also heard from the community that Supabase’s newly released support for external auth providers works, but we don’t have any examples for this yet.
Enabling Supabase Auth
To implement either Supabase Auth or Anonymous Sign-Ins, enable the relevant setting on the PowerSync instance, and provide your Supabase JWT Secret. Internally, this setting allows PowerSync to verify and use Supabase JWTs directly using HS256 and the provided secret.PowerSync Cloud instances:
- In the PowerSync Dashboard, select your project and instance and go to the Client Auth view.
- Enable the “Use Supabase Auth” checkbox.
- Copy your JWT Secret from your Supabase project’s settings (JWT Keys section in the Supabase dashboard).
- If your Supabase project uses the legacy JWT signing keys, paste the secret into the “Supabase JWT Secret (optional) Legacy” field. If you’re using Supabase’s new JWT signing keys, you can leave this field empty.
- Click Save and Deploy to apply the changes.
PowerSync is compatible with Supabase’s new JWT signing keys. If you’re using the new keys, you don’t need to provide the legacy JWT secret. See this Discord thread for details.
Self-hosted instances:
This can be enabled via yourconfig.yaml:
Sync Rules
The Supabase user UUID will be available asrequest.user_id() in Sync Rules. To use a different identifier as the user ID in Sync Rules (for example user email), use Custom authentication.