Development Tokens

PowerSync allows generating temporary development tokens for authentication. This is useful for developers who want to get up and running quickly, without a full custom auth implementation. This may also be used to generate a token for a specific user to debug issues.

Generating a Development Token

  1. Enable setting: The "Enable development tokens" setting must be set on the PowerSync instance. This should be enabled by default for new instances. It can be set in the instance's config (In the PowerSync dashboard: Edit instance -> Client Auth).

  1. Generate token: Call the "Generate development token" action for your instance. In the PowerSync dashboard, this can be done via the command palette (CMD+SHIFT+P / SHIFT+SHIFT), or by selecting it from an instance's options (right-click on an instance for options).

  1. Enter token subject / user ID: This is the ID of the user you want to authenticate and is used in sync rules as token_parameter.user_id.

  1. Copy the generated token. Note that these tokens expire after 12 hours.

Usage

To use the temporary development token, update the fetchCredentials() function in your backend connector to return the generated token (see Integrate with your Backend for more information).

Example:

return PowerSyncCredentials(
        endpoint: AppConfig.powersyncUrl,
        token: 'temp-token-here');

Last updated