feat: Improved toolbar authentication (with support for CLI)
Problem
For the CLI hackathon - adds a secure flow for passing a jwt to the cli to be used.
The outcome of this made me think that we could use this for the toolbar as well, improving the auth flow for it and potentially allowing solutions that don't work well with the hash param state (via posthog.loadToolbar() )
WARNING - As this is auth related we should think slowly before we merge. For now we can demo the tool on this PR.
Changes
- Adds a new auth flow for exhanging a token in a non-interactive way
- Removes
TemporaryTokenAuthenticationin favour of the new JWT based flow
TODO
- Add scopes support to the token generation
- Fix coming from the app to the JS
- Load projects from the API so that we can correctly get the projectId for a given token
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?
I will close https://github.com/PostHog/posthog/pull/22321 in favor of this one
📸 UI snapshots have been updated
12 snapshot changes in total. 0 added, 12 modified, 0 deleted:
chromium: 0 added, 12 modified, 0 deleted (diff for shard 1)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
Size Change: +1.1 kB (+0.1%)
Total Size: 1.06 MB
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
1.06 MB | +1.1 kB (+0.1%) |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.
📸 UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
📸 UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
📸 UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
📸 UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
📸 UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.