fix(oauth): let a pinned base URL supply its own OAuth client ID - #1172
Closed
posthog[bot] wants to merge 2 commits into
Closed
fix(oauth): let a pinned base URL supply its own OAuth client ID#1172posthog[bot] wants to merge 2 commits into
posthog[bot] wants to merge 2 commits into
Conversation
Add a global `--oauth-client-id` flag (env `POSTHOG_WIZARD_OAUTH_CLIENT_ID`), threaded through `getOAuthClientId` and `getProvisioningClientId`. Before, any pinned `--base-url` run always sent the dev OAuth client ID, so a self-hosted or local instance that does not seed the dev OAuth app answered `invalid_client` and login could not complete. An explicit client ID now wins over the base-URL heuristic; the base-URL and region defaults are unchanged when the flag is absent. The `invalid_client` message now names the new flag. Generated-By: PostHog Desktop Task-Id: b221e56b-7a82-4bd3-8851-2ed08b422dc9
Contributor
Author
🦔 PostHog Review reviewed this pull requestFound 0 must fix, 1 should fix, 0 consider. Published 1 finding (view the review). Resolved comments: 1 fixed |
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
Contributor
Author
|
PostHog Review alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏 |
`wizard mcp add` accepted the global --oauth-client-id flag but never copied it into the session, so the Slack-connect and suggested-prompts login screens fell back to the dev client ID and a pinned self-hosted instance could still answer invalid_client — the exact failure this PR fixes everywhere else. Pass oauthClientId to buildSession like the sibling tutorial command, and cover both overrides in the command test. Generated-By: PostHog Desktop Task-Id: 4cbcaf4a-2fd7-429a-9c04-8a1a87e2f1fe
Collaborator
|
no one should be using this publically |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
--base-urlcould not log in — the token endpoint answeredinvalid_clientand login stopped completely.getOAuthClientIdhas only two answers: the production proxy client, or the dev client whenever any base URL resolves. So every pinned run sends the dev client ID, which an instance that does not seed the dev OAuth app rejects.--base-urlis a hidden but fully live global flag in published builds (unlike the--local-*targets, which published builds reject), so this hits real self-hosted and local pinned runs.Changes
--oauth-client-idflag (envPOSTHOG_WIZARD_OAUTH_CLIENT_ID), hidden like--base-url.getOAuthClientId(login) andgetProvisioningClientId(signup); the base-URL and region defaults are unchanged when the flag is absent.getOrAskForProjectData→askForWizardLogin→performOAuthFlow/provisionNewAccount), plus the Slack-connect, MCP-tutorial,provision, and CI-signup entry points.invalid_clientremediation message now names--oauth-client-idas an alternative to seeding the OAuth app.oauth.tsandprovisioning.tsthat proposed exactly this flag.Test plan
provisionNewAccountsends an explicitoauthClientIdinstead of the region client.invalid_clientmessage mentions--oauth-client-id.pnpm build && pnpm test— all 2475 tests pass;pnpm lint— 0 errors.LLM context
Authored by a PostHog scout agent. The fix follows the TODO the code already carried at
src/utils/oauth.ts. Scoped strictly to client-ID selection — it does not change whether a fully explained config failure still files an exception (open PR #1131 makes that call foraccess_denied).Created with PostHog Desktop from this inbox report.