Self-Hosting
Generate a Development Token
In this tutorial we will show you how to generate a development token for the self-hosted PowerSync Service.
Introduction
Development tokens are useful for:
- getting started quickly without implementing full auth config
- sanity checking your sync rules config (were they applied correctly)
- temporarily impersonating a specific user to debug specific issues
Use Case
Development tokens can be used either with the
Generate a Development Token
Development tokens can be generated via either
- PowerSync Cloud, or
- locally with a self-hosted setup (described in this tutorial)
1
Generate a SharedSecret
To generate a SharedSecret, you can use this Online JWS key generator:
You don’t need to edit the default payload in the Online JWS key generator.
You simply need to obtain the generated SharedSecret
value.
- Click
Generate JWS Keys
- Copy the
SharedSecret
value
Using an online key generator for secrets in a production environment is not recommended.
2
Update powersync.yaml
Update the k
value in the jwks keys in your powersync.yaml
config file with the SharedSecret
value copied in the previous step:
powersync.yaml
3
Generate a development token
- If you have not done so already, clone the powersync-service repo
- Install the dependencies
- In the project root, run the following commands:
- In the
test-client
directory, run the following commands:
- In the project root, run the following commands:
- Generate a new token by running the following command in the
test-client
directory with your updatedpowersync.yaml
config file:You should see an output similar to the following:
Was this page helpful?