Skip to content

feat(mcp): Make the iOS app a built-in OAuth client - #3879

Merged
armcknight merged 4 commits into
mainfrom
armcknight/ios-builtin-oauth-client
Nov 23, 2026
Merged

armcknight merged 4 commits into
mainfrom
armcknight/ios-builtin-oauth-client

Conversation

@armcknight

@armcknight armcknight commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Note: Current test failure is a known flakiness issue: #3914

The implements a real PKCE OAuth flow for the iOS app using the existing custom schema callback. This is technically possible to be cloned by imposter apps; the alternative is to host a apple-app-site-association file on the server identifying legal clients with a regular HTTPS call back URL, but this change does not represent a regression in security posture. We can consider the site association file in a later PR.

Slop

Junior now knows the iOS app's OAuth client, so sign-in no longer depends on a hosted Client ID Metadata Document.

The app's client_id was a raw GitHub URL on the PR branch of #3544. GitHub deleted that branch after the merge, so the URL returned 404, and every sign-in to a real Junior failed with "The client ID is not a valid client metadata document URL." A raw GitHub URL also proves nothing about who owns the client, because anyone can host a file on that host.

The change follows how the Seer Apple apps sign in to Sentry: the server knows the client, and the redirect uses the app's own URL scheme.

  • JUNIOR_IOS_CLIENT in client-metadata.ts has the ID https://junior.sentry.dev/clients/ios and the redirect junior-ios://oauth/callback. resolveMcpClient returns it without a fetch. The ID stays an HTTPS URL, so it passes the existing client ID rules, and the consent page shows junior.sentry.dev. Nothing is served at that URL, and the app sends this ID, so it must not change.
  • Only this client may use a custom-scheme redirect, and only that exact URI. Other CIMD clients still need https: or loopback http:, because any app can claim a URL scheme. redirectUriMatches now takes the client, so it can apply this rule.
  • The app gets the redirect from ASWebAuthenticationSession, which gives a scheme redirect only to the app that opened the sheet. The LoopbackReceiver NWListener and oauth-client.json are deleted. The mock server also accepts the new redirect.

A server that runs an older Junior rejects the new client ID. So the app can sign in to prod only after a release with this change. Prod also needs a release with #2951 (turnActive), because the app cannot read searchConversations results from 0.310.0.

We could also keep a CIMD document at the new URL, so that older servers still accept the app. We did not, because prod is the only known server for the app.

No screenshot test applies: the sign-in screen does not change.

🤖 Generated with Claude Code

The iOS app's client ID was a raw GitHub URL on a PR branch. When that
branch was deleted after merge, the URL returned 404 and every sign-in
to a real Junior failed.

Junior now knows the app's client (JUNIOR_IOS_CLIENT), so sign-in does
not fetch a Client ID Metadata Document. Only this client may redirect
to its URL scheme, junior-ios://oauth/callback. The app takes the
redirect from ASWebAuthenticationSession and drops its loopback listener.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 23, 2026 8:55pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

1 screenshot change — 1 changed · 0 added · 0 removed

Review screenshots in Frameshift

System Cache Warming · Desktop
System Cache Warming · Desktop
Changed

@armcknight
armcknight marked this pull request as ready for review November 20, 2026 20:42
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 20, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0b2a6db. Configure here.

@blacksmith-sh

This comment has been minimized.

A custom-scheme redirect has the origin "null", so the CSP never allowed junior-ios: and the browser blocked the redirect after Allow.

Co-Authored-By: andrew <[email protected]>
@armcknight
armcknight marked this pull request as draft November 20, 2026 23:48
@armcknight
armcknight marked this pull request as ready for review November 21, 2026 00:20
@armcknight
armcknight enabled auto-merge (squash) November 23, 2026 20:55
@armcknight
armcknight merged commit b0e3889 into main Nov 23, 2026
61 checks passed
@armcknight
armcknight deleted the armcknight/ios-builtin-oauth-client branch November 23, 2026 21:11

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 2ef6e752 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants