From f0d5c3fe5a2a9c682032f3f3081df9e95a4ac437 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 19 Jun 2026 15:40:28 +0000 Subject: [PATCH] fix(auth): open mobile OAuth in external browser to keep keyboard working 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) Claude-Session: https://claude.ai/code/session_01Uj1HRmSGLKX5sa1pqY1oFY --- frontend/src/cognito/auth.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/cognito/auth.ts b/frontend/src/cognito/auth.ts index 1e2c1cb81..d85d86825 100644 --- a/frontend/src/cognito/auth.ts +++ b/frontend/src/cognito/auth.ts @@ -243,7 +243,12 @@ export class AuthService { `scope=${this.scope.join('+')}`, ] const authUrl = `https://${this.config.cognitoAuthDomain}/oauth2/authorize?${params.join('&')}` - await windowOpen(authUrl, 'auth') + // Open the hosted UI in the external system browser rather than the in-app + // browser. On iOS, presenting and dismissing the in-app browser (SFSafariViewController) + // over the WKWebView leaves the web view unable to raise the soft keyboard, so + // returning to the sign-in form (e.g. after canceling) breaks email/password entry. + // The auth flow returns via the authCallback deep link, so an external browser works. + await windowOpen(authUrl, 'auth', true) // await this.loginWithCognito() @TODO implement with oauth2 } @@ -433,7 +438,9 @@ export class AuthService { `scope=${this.scope.join('+')}`, ] const logoutUrl = `https://${this.config.cognitoAuthDomain}/logout?${params.join('&')}` - await windowOpen(logoutUrl, 'auth') + // Use the external browser (see mobileAuth) so the WKWebView keyboard keeps + // working on the sign-in form the user returns to after signing out. + await windowOpen(logoutUrl, 'auth', true) } await this.cognitoAuth.signOut() } catch {}