Generating a Development Token
- PowerSync Cloud
- Self-Hosted
- In the PowerSync Dashboard, select your project and instance
- Go to the Client Auth view
- Check the Development tokens setting and save your changes
- Click the Connect button in the top bar
- Enter a user ID:
- If you’re only using global Sync Rules / Streams, you can enter any value (e.g.,
test-user) since all data syncs to all users - If you’re using any Sync Rules / Streams that filter data by user, enter a user ID that matches a user in your database. The user ID will be used as
request.user_id()in your Sync Rules orauth.user_id()in Sync Streams.
- If you’re only using global Sync Rules / Streams, you can enter any value (e.g.,
- Click Generate Token and copy the token
Development tokens expire after 12 hours.
Usage
Development tokens can be used for testing purposes either with the Sync Diagnostics Client, the test-client, or your app itself (for development purposes).Using with Sync Diagnostics Client
The Sync Diagnostics Client allows you to quickly test syncing and inspect a user’s SQLite database, to verify that your PowerSync Service configuration and Sync Rules / Streams behave as expected.- Open the Sync Diagnostics Client
- Enter the generated development token at PowerSync Token.
- Enter your PowerSync Service endpoint URL at PowerSync Endpoint unless already prepopulated.
- Click Proceed.
- Wait for the syncing to complete and inspect the synced data in SQLite.
Using with test-client
The test-client is useful for testing of syncing without persisting anything to a client-side SQLite database. Amongst other things, it can be used for load testing, simulating many client syncing concurrently. Consult the README for details on how to provide the development token as argument to test-client supported commands.
Using with Your Application
To use the temporary development token in your application, update thefetchCredentials() function in your backend connector to return the generated token.