Skip to content

Preserve gateway sign-in state during OAuth redirects - #205

Merged
Paladin173 merged 3 commits into
mainfrom
issue-184-chrome-sign-in
Nov 15, 2026
Merged

Paladin173 merged 3 commits into
mainfrom
issue-184-chrome-sign-in

Conversation

@Paladin173

@Paladin173 Paladin173 commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • An approved gateway's recognized OAuth start now establishes the in-app flow before redirecting, so its state cookie can reach the callback.
  • Diagnostics identify why a recognized Chrome sign-in request fell back without recording OAuth URLs or parameters.
  • Existing gateway consent, callback verification and browser-support checks remain in place. No new permission or JavaScript bridge is added.

This fixes a reproduced in-app routing case, not a confirmed root cause for the reporter's particular deployment. Sign in with Chrome remains unresolved for this gateway-start scenario: the gateway start must stay in WebView because Chrome has a separate cookie store. A safe handoff after the gateway redirect, including state/PKCE continuity, needs further investigation and live acceptance. Direct Pocket ID WebView passkeys and the separate upstream Dashboard root-route bug remain unresolved.

Pocket ID is a self-hosted passkey-based identity provider; TinyAuth can act as the sign-in gateway. The current TinyAuth source creates the OAuth session cookie when its frontend requests an authorization URL and checks it at the callback; its frontend then navigates to that URL. This PR's redirect fixture is a different possible gateway sequence, not a reproduction of the reporter's exact TinyAuth flow. The Chrome Auth Tab documentation requires Digital Asset Links on an HTTPS callback host. These observations do not establish why the reporter's Chrome handoff did not launch.

Related #184.

Testing

  • ProxyAuthRedirectInstrumentationTest: a same-gateway OAuth start that immediately redirects to the provider completes the HTTP fallback with the cookie set by the start response. A Chrome-equipped API 36 emulator checks the main-frame start and invokes the shared browser-launch guard used by popups; it does not drive an actual popup.

  • RED/GREEN: the new HTTP gateway test failed on the base navigation code and passed with the change. On the Chrome-equipped emulator, sending the gateway start directly to Auth Tab made the cookie-safety test fail; removing the shared launch guard also failed it. Both guards were restored and passed. Changing the gateway fallback reason made its diagnostic assertion fail; the source was restored and passed.

  • Independent review: identified that launching the gateway start in Chrome can lose its callback state cookie. Main-frame handling and the shared browser-launch guard used by popup paths now keep the start in WebView. A follow-up review of commit 4932bb79c0c066ef8d4364f2a439e836772470b1 found no new significant bug, but confirmed the test does not exercise a popup end to end. A correlated handoff and real provider testing remain needed before claiming Chrome sign-in is fixed.

  • .\gradlew.bat testDebugUnitTest lintDebug assembleDebug connectedDebugAndroidTest "-Pandroid.testInstrumentationRunnerArguments.class=com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_sameOriginAuthorization_keepsStartInWebViewWhenBrowserSupportsAuthTab,com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_sameOriginAuthorizationRedirect_continuesInApp,com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_withSignInWithChromeAndHttpCallback_continuesInApp,com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_keepsProviderInAppSoTheGatewayCallbackHasItsCookie" --no-daemon: passed on API 36 with Chrome 156 (four selected tests). An earlier run failed when a WebView navigation dropped a DOM-readiness JavaScript callback; the fixture now retries dropped callbacks until the existing readiness timeout, and the rerun passed.

  • .\gradlew.bat connectedDebugAndroidTest "-Pandroid.testInstrumentationRunnerArguments.class=com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_sameOriginAuthorizationRedirect_continuesInApp,com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_withSignInWithChromeAndHttpCallback_continuesInApp,com.hermeswebui.android.ProxyAuthRedirectInstrumentationTest#proxyGatewayOidc_keepsProviderInAppSoTheGatewayCallbackHasItsCookie" --no-daemon: passed on API 35 (three selected tests).

  • python -m unittest discover -s tools/tests -p "test_*.py": passed, 121 tests. python tools/check_markdown.py: passed, 26 files.

  • GitHub Actions on commit 4932bb79c0c066ef8d4364f2a439e836772470b1: passed all gates, including the full API 35 and 36 instrumentation suites.

  • Manual device check: none. Tests used isolated emulators.

  • Not covered: a real popup round trip, Chrome Auth Tab callback or Digital Asset Links verification, a live gateway/Pocket ID flow, the reporter's device, direct WebView passkeys, and the upstream Dashboard root-route fix.

  • .\gradlew.bat testDebugUnitTest --no-daemon

  • .\gradlew.bat lintDebug --no-daemon

  • .\gradlew.bat assembleDebug --no-daemon

  • python -m unittest discover -s tools/tests -p "test_*.py" and python tools/check_markdown.py

  • Targeted connectedDebugAndroidTest on API 35 and API 36 emulators; CI runs the full suites on API 35 and 36.

QA checklist

  • Behavior changes have the cheapest test that would have caught the regression; the new test was seen to fail with the fix reverted.
  • Injected WebUI JavaScript or a WebUI shim change was also checked with tools/qa against a real server, and the redacted report.md summary is pasted below (or marked not applicable).
  • Security rules hold: no SSL error bypass, no dashboard-config writes, non-allowlisted HTTP/HTTPS stays externalized, no new JavaScript bridge for secrets.
  • No server URL, hostname, credential, keystore, or local machine path is in the diff. Test URLs use synthetic reserved and loopback hosts.
  • README.md, ROADMAP.md, ARCHITECTURE.md, and AGENTS.md are updated where behavior, setup, architecture, or workflow changed.
  • Labels applied from the release-note set (enhancement, user-facing, bug, documentation, skip-changelog).

Live QA summary (if applicable)

Not applicable: no injected WebUI script or shim changed. No live server was tested.

🤖 Generated with GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Paladin173 Paladin173 added the bug Something isn't working label Nov 15, 2026
@Paladin173 Paladin173 self-assigned this Nov 15, 2026
@Paladin173 Paladin173 changed the title Fix Chrome sign-in for approved gateway redirects Preserve gateway sign-in state during OAuth redirects Nov 15, 2026
Paladin173 and others added 2 commits November 14, 2026 20:52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Paladin173
Paladin173 marked this pull request as ready for review November 15, 2026 04:22
@Paladin173
Paladin173 merged commit 0c542de into main Nov 15, 2026
12 checks passed
@Paladin173 Paladin173 mentioned this pull request Nov 15, 2026
7 of 11 tasks
@Paladin173
Paladin173 deleted the issue-184-chrome-sign-in branch November 15, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant