Skip to content

fix(frontend): pass redirect_uri for multi-cluster GitHub App OAuth#1441

Merged
markturansky merged 3 commits intoambient-code:mainfrom
jsell-rh:fix/github-oauth-redirect-uri
Apr 23, 2026
Merged

fix(frontend): pass redirect_uri for multi-cluster GitHub App OAuth#1441
markturansky merged 3 commits intoambient-code:mainfrom
jsell-rh:fix/github-oauth-redirect-uri

Conversation

@jsell-rh
Copy link
Copy Markdown
Contributor

Summary

  • When multiple clusters share a single GitHub App, GitHub doesn't know which cluster to redirect back to after installation
  • Pass redirect_uri in the GitHub App install URL so GitHub redirects to the correct cluster
  • Adds GITHUB_CALLBACK_URL env var for explicit override; falls back to window.location.origin + '/integrations/github/setup'

Root cause

The handleConnect function sent users to https://github.com/apps/{slug}/installations/new without a redirect_uri. GitHub would pick its default callback URL, which could point to a different cluster.

Test plan

  • Set GITHUB_CALLBACK_URL on frontend deployment, verify redirect goes to correct cluster
  • Without GITHUB_CALLBACK_URL set, verify it falls back to current origin
  • Verify GitHub App install flow completes successfully on multi-cluster setup

🤖 Generated with Claude Code

jsell-rh and others added 2 commits April 23, 2026 15:36
…-cluster support

When multiple clusters share a single GitHub App, GitHub doesn't know
which cluster's callback URL to use. Pass redirect_uri derived from
the current origin (or GITHUB_CALLBACK_URL env var) so GitHub redirects
back to the correct cluster.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit 39171fa
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/69ea7601c9a5a20008588c8a

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@jsell-rh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: af918227-0e95-49f3-a95c-95857cd82624

📥 Commits

Reviewing files that changed from the base of the PR and between d7533c8 and 39171fa.

📒 Files selected for processing (5)
  • components/frontend/README.md
  • components/frontend/src/app/integrations/IntegrationsClient.tsx
  • components/frontend/src/app/integrations/page.tsx
  • components/frontend/src/components/github-connection-card.tsx
  • components/runners/ambient-runner/tests/test_shared_session_credentials.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Revert removal of _GH_WRAPPER_DIR/_PATH imports, add noqa suppression
- Document GITHUB_APP_SLUG and GITHUB_CALLBACK_URL in frontend README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jsell-rh jsell-rh force-pushed the fix/github-oauth-redirect-uri branch from c1977f2 to 39171fa Compare April 23, 2026 19:41
@markturansky markturansky merged commit d845d7f into ambient-code:main Apr 23, 2026
6 checks passed
markturansky pushed a commit that referenced this pull request Apr 23, 2026
…Map patch (#1443)

## Summary

Follow-up to #1441. Two things that didn't make it into the squash
merge:

- **Callback path fix**: Update fallback from
`/integrations/github/setup` to `/api/auth/github/user/callback`
(confirmed by team as the correct path for all clusters)
- **Production overlay patch**: Add kustomize JSON patch that injects
`GITHUB_CALLBACK_URL` from a per-cluster `frontend-config` ConfigMap

## Per-cluster setup after deploy

```bash
# UAT
oc create configmap frontend-config \
  --from-literal=github-callback-url=https://ambient-code.apps.rosa.vteam-uat.0ksl.p3.openshiftapps.com/api/auth/github/user/callback \
  -n ambient-code

# Stage
oc create configmap frontend-config \
  --from-literal=github-callback-url=https://ambient-code.apps.rosa.vteam-stage.7fpc.p3.openshiftapps.com/api/auth/github/user/callback \
  -n ambient-code
```

Then `oc rollout restart deployment/frontend -n ambient-code` on each.

## Test plan

- [ ] Verify GitHub App install redirects back to correct cluster on UAT
- [ ] Verify GitHub App install redirects back to correct cluster on
stage
- [ ] Verify fallback works when `frontend-config` ConfigMap is not
present

🤖 Generated with [Claude Code](https://claude.ai/code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Configuration Updates**
* Updated GitHub OAuth callback URL endpoint configuration for frontend
deployments across staging and production environments.
* Callback URL now defaults to the API authentication endpoint instead
of the integrations setup route.

* **Documentation**
* Updated configuration documentation to reflect the new default GitHub
callback URL path and deployment setup instructions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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