authgear / authgear-sdk-js

Authgear authentication SDK for Single Page Applications (SPA) and JavaScript websites
https://www.authgear.com/
Other
5 stars 18 forks source link

Ionic support #253

Closed fungc-io closed 10 months ago

fungc-io commented 11 months ago
louischan-oursky commented 11 months ago

Study done on 2023-12-14

I followed official get started tutorial and created an iOS app.

ionic start
npx cap add ios
pod install
npx cap run ios

And then install @authgear/web.

@authgear/web uses window.location.href = REDIRECT_URI under the hood. Capacitor handles this by opening the external browser. This is not something what we want to deliver.

In this Auth0 tutorial, @capacitor/browser is recommended. However, SFSafariViewController is used under the hood. Our React Native SDK and Flutter SDK uses ASWebAuthenticationSession. This means we need to develop a Capacitor SDK.

louischan-oursky commented 11 months ago
fungc-io commented 11 months ago

@louischan-oursky How long to you estimate needed to add biometric to the SDKs for iOS and Android?

louischan-oursky commented 11 months ago

2 days

louischan-oursky commented 11 months ago

I have done some research on PWA in the context of an Ionic app. Here are my findings.

  1. An Ionic app is built with web technologies. It requires a runtime to host.
  2. The typical runtime is Capacitor.
  3. Capacitor runs an Ionic app with a WKWebView on iOS. The WKWebView loads pages served by a local HTTP server.
  4. The definition of PWA is the same in the context of an Ionic app. It means a web app being served by a HTTPS server, utilizing service worker. A PWA can be used offline if a cached version of it is available.
  5. Therefore, an Ionic app by default has the advantages of PWA already. It is because the assets (HTML, JavaScript, CSS) are bundled in the app, and are served by a local HTTP server. An Ionic app DOES NOT need network to load.
  6. PWA in Ionic is about using the same Ionic codebase to support a new deployment target: PWA. It means the same codebase can be deployed on a public-facing HTTPS server. This requires the codebase to be platform-aware.
  7. "Authgear and PWA in Ionic" hence means how the developer integrates Authgear with their Ionic app, with the guarantee that both the Web platform, and the native platforms are both supported. This translates to how do we educate the developer to use @authgear/web and @authgear/capacitor simultaneously in an Ionic app. One important thing to note is that even the Ionic is not PWA, an Ionic app itself can always be run on a web browser already. So what we need to do is the same, to educate the developer to integrate @authgear/web and @authgear/capacitor in their Ionic app.
fungc-io commented 10 months ago

released