Skip to content

fix(auth): open mobile OAuth in external browser to keep keyboard working#1115

Open
JamieRuderman wants to merge 1 commit into
mainfrom
claude/mobile-login-keyboard-qi8746
Open

fix(auth): open mobile OAuth in external browser to keep keyboard working#1115
JamieRuderman wants to merge 1 commit into
mainfrom
claude/mobile-login-keyboard-qi8746

Conversation

@JamieRuderman

Copy link
Copy Markdown
Member

Problem

On mobile, the soft keyboard fails to appear on the sign-in form after returning from a federated (Google/Apple) sign-in attempt.

Repro: Tap Sign in with Google → cancel the OAuth page → return to the app → tap the email/password field → no keyboard.

Root cause

Google/Apple sign-in (mobileAuth) and sign-out opened the Cognito hosted UI in Capacitor's in-app browser (Browser.openSFSafariViewController on iOS) via windowOpen(authUrl, 'auth').

On iOS, once an SFSafariViewController has been presented over the WKWebView and then dismissed (e.g. the user cancels), the underlying web view can no longer raise the soft keyboard. The fields are enabled (the loading reset from #1097 works correctly) — the WebView has simply lost the ability to present the keyboard. This path was introduced with the new custom auth UI in #1063.

Fix

Open the OAuth and logout URLs in the external system browser instead of the embedded one (passing the existing external flag to windowOpenAppLauncher.openUrl).

  • The flow already returns via the remoteit://authCallback / signoutCallback deep link with the authorization-code response (responseType = 'code'), so the success path is unchanged.
  • Using an external user-agent for OAuth also follows platform best practice (RFC 8252).
  • Sign-out is changed too, since the user lands back on the same sign-in form afterward and would otherwise hit the identical issue.

Testing notes

Needs a device/simulator check (can't run the mobile app in CI):

  1. Tap Sign in with Google → cancel → confirm the email/password keyboard now works.
  2. Confirm a real Google/Apple sign-in still completes and returns to the app.
  3. Confirm sign-out still works.

Expected UX change: with the external browser, a successful sign-in won't auto-dismiss the browser tab the way the in-app browser did — the app comes to the foreground via the deep link, but the OAuth tab may remain in the background browser. This is standard for this OAuth pattern and is the tradeoff for reliable keyboard behavior.

🤖 Generated with Claude Code


Generated by Claude Code

…king

On mobile, Google/Apple sign-in and sign-out opened the Cognito hosted UI
in the in-app browser (SFSafariViewController on iOS). Presenting and
dismissing it over the WKWebView leaves the web view unable to raise the
soft keyboard, so returning to the sign-in form (e.g. after canceling)
broke email/password entry.

Open the OAuth/logout URLs in the external system browser instead. The
flow already returns via the authCallback/signoutCallback deep link, so
the success path is unchanged, and using an external user-agent for OAuth
also follows platform best practice (RFC 8252).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uj1HRmSGLKX5sa1pqY1oFY
@aws-amplify-us-west-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1115.d20k671nqqv4kl.amplifyapp.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