Skip to content

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Aug 13, 2024

A self-hosted setup often uses powersync-dev as the audience, instead of the endpoint URL. This updates the generate-token script to include the endpoint URL as an additional audience. This defaults to http://127.0.0.1:<port>. but can be customized.

This also increases the token expiry from 1h to 24h.

Combined with powersync-ja/powersync-js#264, this helps streamline usage of the diagnostics app for local development.

Sample:

pnpm generate-token -c ../service/powersync.yaml 

> [email protected] generate-token /home/ralf/src/powersync-service/test-client
> tsc -b && node dist/bin.js generate-token "-c" "../service/powersync.yaml"

Payload:
{
  "sub": "test_user",
  "iat": 1723548362,
  "iss": "test-client",
  "aud": [
    "powersync-dev",
    "http://127.0.0.1:8080"
  ],
  "exp": 1723634762
}
Token:
eyJhbGciOiJIUzI1NiIsImtpZCI6InBvd2Vyc3luYy1kZXYifQ.e...

Copy link

changeset-bot bot commented Aug 13, 2024

⚠️ No Changeset found

Latest commit: 68e3385

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rkistner rkistner merged commit 8686e3d into main Aug 13, 2024
@rkistner rkistner deleted the test-client-local-endpoint branch August 13, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants