posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: Improved toolbar authentication (with support for CLI)

Open benjackwhite opened this issue 1 year ago • 3 comments

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 TemporaryTokenAuthentication in 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?

benjackwhite avatar May 15 '24 15:05 benjackwhite

I will close https://github.com/PostHog/posthog/pull/22321 in favor of this one

marandaneto avatar May 22 '24 10:05 marandaneto

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 23 '24 15:05 posthog-bot

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%)

compressed-size-action

github-actions[bot] avatar May 23 '24 15:05 github-actions[bot]

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.

posthog-bot avatar May 31 '24 07:05 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 31 '24 08:05 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 31 '24 09:05 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 31 '24 09:05 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 31 '24 11:05 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 31 '24 11:05 posthog-bot

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.

posthog-bot avatar Jun 10 '24 07:06 posthog-bot

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.

posthog-bot avatar Jun 18 '24 07:06 posthog-bot