You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cordova/Capacitor app running in WKWebview on iPadOS
Firebase SDK Version
11.2.0
Firebase SDK Product(s)
Auth
Project Tooling
Cordova app with webpack
Detailed Problem Description
The auth-compat module relies on matching the URL scheme and user agent string to detect whether it is running in a Cordova/Capacitor Webview in _isAndroidOrIosCordovaScheme.
However, since iPadOS 13 (circa 2019), Safari (and its WKWebView implementation) began identifying itself with a user agent string similar to that of macOS to provide a desktop-like browsing experience. This change means that the user agent string no longer contains iPad and instead resembles that of a Mac.
For example the user agent string of my iPad Simulator is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148.
This means the current detection fails to correctly detect that it is running in a Cordova/Capacitor Webview when running on an iPad, so assumes it's a desktop browser environment.
Therefore when the auth-compat module is imported, this leads to a run-time error:
Hi @dpa99c, thank you for bringing this to our attention. I was able to replicate the issue. I'll take a closer look and see what we can do or loop in someone who has more context. I'll update this thread as soon as I have more details or information to share.
Operating System
iPadOS 17.6.1
Environment (if applicable)
Cordova/Capacitor app running in WKWebview on iPadOS
Firebase SDK Version
11.2.0
Firebase SDK Product(s)
Auth
Project Tooling
Cordova app with webpack
Detailed Problem Description
The auth-compat module relies on matching the URL scheme and user agent string to detect whether it is running in a Cordova/Capacitor Webview in
_isAndroidOrIosCordovaScheme
.However, since iPadOS 13 (circa 2019), Safari (and its WKWebView implementation) began identifying itself with a user agent string similar to that of macOS to provide a desktop-like browsing experience. This change means that the user agent string no longer contains iPad and instead resembles that of a Mac.
For example the user agent string of my iPad Simulator is
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
.This means the current detection fails to correctly detect that it is running in a Cordova/Capacitor Webview when running on an iPad, so assumes it's a desktop browser environment.
Therefore when the auth-compat module is imported, this leads to a run-time error:
Steps and code to reproduce issue
ionic start firebase-test blank --type=angular --cordova && cd firebase-test
npm install -g @angular/cli
ng add @ionic/cordova-builders
ionic cordova platform add ios
src/main.ts
and add:ionic build
cordova platform prepare ios
platforms/ios/firebase-test.xcworkspace
in XcodeThen add the Firebase SDK:
npm i firebase
src/main.ts
and add:ionic build
ionic cordova prepare ios
The text was updated successfully, but these errors were encountered: