Ionic Capacitor 2 Improves Mobile Authentication and Cross-Domain HTTPS

The recent Ionic Capacitor 2 release updates the underlying Swift, XCode, and Android versions, adds Face Unlock and Iris Unlock, improves the core Capacitor plugins, and simplifies cross-domain HTTPS requests.

Capacitor is an alternative to Cordova, PhoneGap, or React Native that allows developers to build web apps for iOS, Android, and Progressive Web Apps from a single codebase.

Capacitor 2 updates its underlying iOS and Android foundations. For iOS applications, Capacitor now leverages Swift 5 and Xcode 11+ to decrease app bundle sizes and leverage improvements to developer tooling. Android apps now leverage Android 10 (SDK29) and AndroidX.

A recent update by Apple requires apps that offer third-party or social login services to offer sign-in with Apple, so Capacitor 2 now provides a sign-in with Apple plugin.

Through the update to AndroidX, the Ionic Identity Vault adds Android Face Unlock and Iris Unlock support and previously supported authentication mechanisms like Apple's TouchID and FaceID. Note that the Identity Vault is a paid service on top of the otherwise open-source Capacitor.

Cross-domain requests within web applications are typically managed through Cross-Origin Resource Sharing (CORS) to prevent attacks that compromise users of web applications. However, with hybrid and native mobile apps, this can be challenging to solve, so the Capacitor team has introduced a new Capacitor HTTP plugin to help alleviate these challenges and provide a CORS troubleshooting guide.

The Capacitor CLI provides a straightforward approach for developers to upgrade to Capacitor version 2. A few manual steps are part of the upgrade process. For example, iOS requires a change within XCode to convert a codebase to the current Swift syntax. Complete information exists within the Capacitor Docs.

Capacitor version 2 also improves and stabilizes the 23 included plugins with support for features such as accessibility and camera to filesystem and geolocation. Capacitor also remains compatible with Cordova, making it possible to leverage Cordova plugins' full range within Capacitor.

While Capacitor also supports Electron apps for using web technology for native desktop apps, this remains in beta status.

Initial feedback by the Capacitor community was generally positive, and most questions received quick answers with links to the relevant documentation for features such as live reloading.

Developers can leverage Capacitor with many JavaScript or TypeScript frameworks. Furthermore, Capacitor provides the foundation for Ionic's mobile app strategy. The Ionic team offers guidance comparing Ionic plus Capacitor vs. Xamarin and Ionic plus Capacitor vs. React Native. While these guides are from the perspective of Ionic and Capacitor, they are informative in explaining these platforms' differences and benefits.

Ionic Capacitor is open-source software available under the MIT license. Contributions are welcome via the Capacitor contribution guidelines, and contributors should follow the Capacitor code of conduct.