Generating a Development Token:
PowerSync Cloud - Dashboard:
- Enable setting: The “Enable development tokens” setting must be set on the PowerSync instance. In the PowerSync Dashboard, select your project and instance, go to the Client Auth view, and enable the “Enable development tokens” setting.
- Next, click the Connect button in the top bar, and follow the instructions to generate a development token.
- Enter the token subject / user ID: This is the ID of the user you want to authenticate and is used in Sync Rules as
request.user_id(). - Click Generate Token. Copy the generated token. Note that these tokens expire after 12 hours.
Self-hosted Setup / Local Development
For self-hosted local development, the powersync-service test client contains a script to generate a development token, given a .yaml config file with an HS256 key. Run the following command:Usage
To use the temporary development token, update thefetchCredentials() function in your backend connector to return the generated token (see Integrate with your Backend for more information).
Example: