Title: [expo] iOS native Google sign-in fails with "Unable to open Safari." — getPresentingViewController picks an arbitrary scene and window · Issue #9504 · clerk/javascript · GitHub
Open Graph Title: [expo] iOS native Google sign-in fails with "Unable to open Safari." — getPresentingViewController picks an arbitrary scene and window · Issue #9504 · clerk/javascript
X Title: [expo] iOS native Google sign-in fails with "Unable to open Safari." — getPresentingViewController picks an arbitrary scene and window · Issue #9504 · clerk/javascript
Description: Package @clerk/expo@3.6.5 (useSignInWithGoogle, iOS). The same code is present verbatim in @clerk/expo-google-signin@1.0.1, so upgrading does not resolve it. What happens On a release iOS build, tapping "Continue with Google" never reach...
Open Graph Description: Package @clerk/expo@3.6.5 (useSignInWithGoogle, iOS). The same code is present verbatim in @clerk/expo-google-signin@1.0.1, so upgrading does not resolve it. What happens On a release iOS build, ta...
X Description: Package @clerk/expo@3.6.5 (useSignInWithGoogle, iOS). The same code is present verbatim in @clerk/expo-google-signin@1.0.1, so upgrading does not resolve it. What happens On a release iOS build, ta...
Opengraph URL: https://github.com/clerk/javascript/issues/9504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[expo] iOS native Google sign-in fails with \"Unable to open Safari.\" — getPresentingViewController picks an arbitrary scene and window","articleBody":"### Package\n\n`@clerk/expo@3.6.5` (`useSignInWithGoogle`, iOS). The same code is present verbatim in\n`@clerk/expo-google-signin@1.0.1`, so upgrading does not resolve it.\n\n### What happens\n\nOn a release iOS build, tapping \"Continue with Google\" never reaches Google. The promise\nrejects with one of:\n\n- `Unable to open Safari.`\n- `The authorization attempt failed for an unknown reason`\n- `No presenting view controller available`\n\nRetrying reproduces it every time within the same session. Sign in with Apple on the same\nbuild is unaffected.\n\n### Cause\n\n`ios/ClerkGoogleSignInModule.swift` resolves the presenting controller like this:\n\n```swift\nprivate func getPresentingViewController() -> UIViewController? {\n guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,\n let window = scene.windows.first,\n let rootVC = window.rootViewController else {\n return nil\n }\n ...\n}\n```\n\n`connectedScenes` is a `Set` and `UIWindowScene.windows` is unordered, so `.first` returns an\narbitrary element in both cases — neither checks `activationState` nor `isKeyWindow`. An app\nwith more than one window (splash, keyboard, an overlay from another module) can therefore\nhand `GIDSignIn` a controller that is not in the visible hierarchy.\n\nThat produces the two observed outcomes:\n\n- resolution returns `nil` → the module's own `\"No presenting view controller available\"`\n- resolution returns an off-screen window → `GIDSignIn` cannot present its authorization\n session and AppAuth reports `OIDErrorCodeSafariOpenError`, surfaced through\n `handleSignInResult` as `error.localizedDescription` → `\"Unable to open Safari.\"`\n\n### Suggested fix\n\n```swift\nprivate func getPresentingViewController() -> UIViewController? {\n let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }\n let scene = scenes.first { $0.activationState == .foregroundActive }\n ?? scenes.first { $0.activationState == .foregroundInactive }\n ?? scenes.first\n\n guard let window = scene?.windows.first(where: { $0.isKeyWindow })\n ?? scene?.windows.first(where: { !$0.isHidden && $0.rootViewController != nil }),\n let rootVC = window.rootViewController else {\n return nil\n }\n\n var topVC = rootVC\n while let presentedVC = topVC.presentedViewController, !presentedVC.isBeingDismissed {\n topVC = presentedVC\n }\n return topVC\n}\n```\n\nThe `isBeingDismissed` guard covers a related case: a controller mid-dismissal is still\nreachable through `presentedViewController` but can no longer present.\n\n### Environment\n\n- Expo SDK 55, React Native 0.83.2, Hermes, Fabric\n- iOS 26.5 / 26.6, physical devices and simulator\n- `GoogleSignIn ~> 9.0` as declared by `ClerkGoogleSignIn.podspec`\n","author":{"url":"https://github.com/Fastdrecad","@type":"Person","name":"Fastdrecad"},"datePublished":"2026-08-19T15:47:58Z","url":"https://github.com/clerk/javascript/issues/9504"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ca61cfe7-346b-b8e2-3c5c-5c696dfdd932 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A052:1F76:393F77:4EBE29:6AFB632F |
| html-safe-nonce | d24e31e96f02a1a2e5440e8177ce41fffdfa4bacde58db0e01c9670819d81b39 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDUyOjFGNzY6MzkzRjc3OjRFQkUyOTo2QUZCNjMyRiIsInZpc2l0b3JfaWQiOiIyOTY4OTgwMDM0NDU2MDg1Mjk1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d7ab3bdb516d8b28abfaca25c0c9cb6794cb5fe21eb08f1a9809350be35c0035 |
| hovercard-subject-tag | issue:5194516961 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/clerk/javascript/9504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7fd296a17d1a8446de2dd2c903f684567228acbf517b2e3ed84f2d13edae3b41/clerk/javascript/issues/9504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7fd296a17d1a8446de2dd2c903f684567228acbf517b2e3ed84f2d13edae3b41/clerk/javascript/issues/9504 |
| og:image:alt | Package @clerk/expo@3.6.5 (useSignInWithGoogle, iOS). The same code is present verbatim in @clerk/expo-google-signin@1.0.1, so upgrading does not resolve it. What happens On a release iOS build, ta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Fastdrecad |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| go-import | github.com/clerk/javascript git https://github.com/clerk/javascript.git |
| octolytics-dimension-user_id | 49538330 |
| octolytics-dimension-user_login | clerk |
| octolytics-dimension-repository_id | 438331492 |
| octolytics-dimension-repository_nwo | clerk/javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 438331492 |
| octolytics-dimension-repository_network_root_nwo | clerk/javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width