[Fix] Link GitHub account 404s when app credentials are stored in deployment env vars - #148
Merged
Merged
Conversation
…linking accounts The Link GitHub account button built the authorize URL from Env.GITHUB_CLIENT_ID, which only reads process env and defaults to an empty string. Deployments that created their GitHub App through the in-product manifest flow store credentials encrypted in the environment_variables table, so the button produced client_id= and GitHub returned a 404. Resolve the client id via resolveDeploymentEnvVar like the rest of the GitHub commands, and return a clear configuration error instead of a broken URL when no client id is available. Apply the same fix to the OAuth code-to-token exchange, which read both the client id and secret from process env and would have failed the callback for the same deployments.
Contributor
|
No code issues found. See task Reviewed the credential-resolution fix in |
mrubens
pushed a commit
that referenced
this pull request
Jul 11, 2026
…S templates - Update the deployment-resolved GitHub client id test to mock R_GITHUB_CLIENT_ID (stale resolution from the develop merge of #148) - Rename legacy names in .env.local.example / .env.production.example to the canonical R_* set and drop dead ROOMOTE_AUTH_TELEGRAM_* entries - Point .roomote/environments/roomote.yaml at R_APP_ENV / R_APP_URL / R_PUBLIC_URL so repo agent environments configure the renamed runtime - Fix missed APP_ENV -> R_APP_ENV in fly.toml, render.yaml, the Railway template/README, deploy/README.md, and the installer (the N-1 dual-write shim in the prod compose and upgrade-compatibility lane is untouched)
8 tasks
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
Clicking Link GitHub (Settings → Linked accounts, onboarding, home onboarding card) redirected to
github.com/login/oauth/authorize?client_id=&..., which GitHub 404s.startAuthenticateGitHubAccountCommandbuilt the authorize URL fromEnv.GITHUB_CLIENT_ID, which only reads process env and defaults to an empty string. Deployments that created their GitHub App through the in-product manifest flow store credentials encrypted in theenvironment_variablestable, so the client id was empty at URL-build time.getGitHubOAuthUser(the callback's code→token exchange, shared with OAuth-on-install linking) read bothGITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETthe same way, so the callback would have failed even with a correct URL.Fix
resolveDeploymentEnvVar(process env first, then DB-stored deployment credentials), matching the rest of the GitHub commands.result.error.getGitHubOAuthUser.Testing
mutations.test.tspass; typecheck, Prettier, ESLint clean.GITHUB_CLIENT_IDin process env): the credentials now resolve from the DB and the link flow reaches GitHub's authorize page.