Skip to main content
Each SDK tab has two files. The first is an authenticator, which gives the SDK a token so it can download data. The second is a mutation uploader, which sends local writes to your backend. Each file has a connect() function. The uploader’s connect() passes both parts, so use it in place of the authenticator’s. Start with the authenticator, and add the uploader before your app writes data. Each authenticator caches its token and clears the cache in invalidateCredentials(), so that resolveCredentials() stays cheap and returns a new token after the SDK invalidates the old one. If your auth library already stores and refreshes the token, you can return that token instead. See When resolveCredentials() is Called. The Kotlin Supabase example does this: it uses the SupabaseAuthenticator and SupabaseUploader classes from the Kotlin SDK’s Supabase integration, and SupabaseAuthenticator reads the token from the Supabase client’s current session on each call. Copy the files for your SDK into your app, then replace the placeholders.

Custom Backend

Your app uses your own auth provider and uploads writes to your own backend, or to the reference write endpoint.

Supabase

Your source database is Supabase and your app uses Supabase Auth.

Custom Backend

The authenticator returns a placeholder token. Replace it with a token from your auth provider. See Authentication Setup. The uploader calls the reference write endpoint, POST /api/data, and sends it the authenticator’s token. The write endpoint accepts the same JWTs as your PowerSync instance. If your API’s request or response format differs, either change the uploader’s request and response handling to match your API, or use the prompt for your coding agent to generate an uploader for it.
1

Connect for Downloads

PowerSyncAuthenticator.js
2

Add Uploads

PowerSyncUploader.js

Supabase

The authenticator signs users in with Supabase Auth and gives the SDK their access token. The uploader writes to Supabase with the Supabase client SDK, which is the PostgREST route. There is no Supabase example for Rust. To write through the Supabase Edge Function instead, use the Supabase authenticator with the reference write endpoint uploader from Custom Backend.
1

Connect for Downloads

SupabaseAuthenticator.js
2

Add Uploads

SupabaseUploader.js