Skip to content

fix: use API origin for GitHub OAuth redirect - #831

Open
krsnna-05 wants to merge 1 commit into
oblien:mainfrom
krsnna-05:fix/github-oauth-redirect-origin
Open

krsnna-05 wants to merge 1 commit into
oblien:mainfrom
krsnna-05:fix/github-oauth-redirect-origin

Conversation

@krsnna-05

Copy link
Copy Markdown

Fix GitHub OAuth redirects for hosted split-origin deployments by returning an absolute API URL instead of a dashboard-relative path.

Motivation

#825

When hosted on separate origins, the dashboard received:

 /api/github/connect/redirect?install_state=... 

The browser resolved this against  https://app.openship.io , resulting in a 404. The redirect must target the API origin at  https://api.openship.io .

Related issue

None — bug fix.

Changes

• apps/api
• Use  resolveApiPublicUrl()  for GitHub OAuth redirect URLs.
• Apply the fix to both App/OAuth connection paths.
• Add a regression test covering the absolute API origin and encoded install state.

Verification

DEPLOY_MODE=desktop bunx vitest run apps/api/test/modules/github/github.controller.test.ts

✓ apps/api/test/modules/github/github.controller.test.ts (4 tests) 106ms
Test Files 1 passed (1)
Tests 4 passed (4)

bun run --cwd apps/api lint

$ tsc --noEmit

The formatter was initially run repository-wide and generated unrelated changes across many files. Those changes were reverted, and only the two changed files were formatted individually:

bunx prettier --write
apps/api/src/modules/github/github.controller.ts
apps/api/test/modules/github/github.controller.test.ts

Checklist

✓ One change per PR — one bug, or one agreed feature, with nothing unrelated bundled in
✓ The diff is scoped — no reformatting or lint fixes on lines I wasn't otherwise changing
✓ A test fails without this change and passes with it
•  bun run test ,  bun run --cwd lint , and  bun format  all pass locally — targeted API tests and lint pass; repository-wide  bun format  was not retained because it modified unrelated files
✓ I understand every line of this diff and can explain it in review

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.

1 participant