From a362d0d29f14253044ce017fd4ff0475a7fbcfb6 Mon Sep 17 00:00:00 2001 From: Tygo Egmond <35234103+tygoegmond@users.noreply.github.com> Date: Fri, 16 Oct 2026 15:33:26 +0200 Subject: [PATCH] feat: auth.webSession, Google and Apple sign-in in the system sign-in sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google refuses to sign in inside an embedded web view, so the page asks the shell to open core's sign-in hop in the system's sign-in sheet (`auth.webSession { url }` → `{ callbackUrl }`, PROTOCOL.md §7.1). The sheet closes on the plugchoice-link scheme and the URL goes back to the page. - iOS: ASWebAuthenticationSession with callback scheme plugchoice-link, sharing Safari's cookies. Listed always; the host app needs nothing. - Android: Chrome's Auth Tab (androidx.browser 1.9 AuthTabIntent), which answers the activity that opened it, so no intent filter and no app competes for the scheme. Listed only when the browser supports Auth Tab; a entry lets the library find a Custom Tabs browser. The callback URL holds a one-time code that is worth nothing without the run's credential; shells never log it. --- android/plugchoice/build.gradle.kts | 2 + .../plugchoice/src/main/AndroidManifest.xml | 7 ++ .../com/plugchoice/internal/BridgeHost.kt | 5 ++ .../com/plugchoice/internal/LinkActivity.kt | 17 +++++ .../com/plugchoice/internal/LinkBridge.kt | 11 +++- .../java/com/plugchoice/internal/WebSignIn.kt | 65 +++++++++++++++++++ .../com/plugchoice/internal/BridgeTest.kt | 18 +++++ bridge/PROTOCOL.md | 20 +++++- .../PlugchoiceSDK/Auth/WebSignIn.swift | 56 ++++++++++++++++ ios/Sources/PlugchoiceSDK/Bridge/Bridge.swift | 21 +++++- .../PlugchoiceSDKTests/BridgeTests.swift | 28 +++++++- 11 files changed, 241 insertions(+), 9 deletions(-) create mode 100644 android/plugchoice/src/main/java/com/plugchoice/internal/WebSignIn.kt create mode 100644 ios/Sources/PlugchoiceSDK/Auth/WebSignIn.swift diff --git a/android/plugchoice/build.gradle.kts b/android/plugchoice/build.gradle.kts index 1d89a14..60822a8 100644 --- a/android/plugchoice/build.gradle.kts +++ b/android/plugchoice/build.gradle.kts @@ -47,6 +47,8 @@ dependencies { api("androidx.activity:activity-ktx:1.12.4") implementation("androidx.core:core-ktx:1.17.0") implementation("androidx.webkit:webkit:1.15.0") + // auth.webSession: Google and Apple sign-in in Chrome's Auth Tab. + implementation("androidx.browser:browser:1.9.0") implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2") // camera.scanCode: the Google code scanner (Play services UI, no camera permission). diff --git a/android/plugchoice/src/main/AndroidManifest.xml b/android/plugchoice/src/main/AndroidManifest.xml index 2767a6b..41f7011 100644 --- a/android/plugchoice/src/main/AndroidManifest.xml +++ b/android/plugchoice/src/main/AndroidManifest.xml @@ -44,6 +44,13 @@ android:name="android.hardware.bluetooth_le" android:required="false" /> + + + + + + +