Skip to content

Commit f8f1aea

Browse files
fix(android): align directLoginAction signature with the shared JS API
The JS directLoginAction(type, data, ephemeralSession, additionalQueryParams) signature is shared across platforms, but the Android @ReactMethod declared only (type, data, ephemeralSession), so the trailing additionalQueryParams argument misaligned with the Promise slot. Declare additionalQueryParams: ReadableMap? so the JS↔native mapping matches iOS. The native Android SDK's directLoginAction(activity, type, data) does not yet accept ephemeralSession/additionalQueryParams (iOS does), so they remain accepted no-ops on Android until frontegg-android-kotlin adds support. Documented in both the Kotlin bridge and the TS API.
1 parent 7500e03 commit f8f1aea

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

android/src/main/java/com/frontegg/reactnative/FronteggRNModule.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.facebook.react.bridge.Promise
77
import com.facebook.react.bridge.ReactApplicationContext
88
import com.facebook.react.bridge.ReactContextBaseJavaModule
99
import com.facebook.react.bridge.ReactMethod
10+
import com.facebook.react.bridge.ReadableMap
1011
import com.facebook.react.bridge.WritableMap
1112
import com.facebook.react.common.LifecycleState
1213
import com.facebook.react.modules.core.DeviceEventManagerModule
@@ -137,8 +138,22 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) :
137138
}
138139

139140
@ReactMethod
140-
fun directLoginAction(type: String, data: String, ephemeralSession: Boolean, promise: Promise) {
141+
fun directLoginAction(
142+
type: String,
143+
data: String,
144+
ephemeralSession: Boolean,
145+
additionalQueryParams: ReadableMap?,
146+
promise: Promise
147+
) {
141148
val activity = reactApplicationContext.currentActivity
149+
// Parity note: the JS `directLoginAction(type, data, ephemeralSession, additionalQueryParams)`
150+
// signature is shared across platforms, so both trailing args must be declared here to keep the
151+
// JS↔native argument mapping aligned (otherwise `additionalQueryParams` collides with the
152+
// Promise slot). iOS honors both (see ios/FronteggRN.swift), but the native Android SDK's
153+
// `directLoginAction(activity, type, data)` does not yet accept them — threading them through
154+
// requires native support in frontegg-android-kotlin. Until then they are accepted no-ops on
155+
// Android. `ephemeralSession` is inherently iOS-only here (Android runs the flow in the embedded
156+
// WebView, not an ASWebAuthenticationSession-style browser session).
142157
auth.directLoginAction(activity!!, type, data)
143158
promise.resolve(true)
144159
}

src/FronteggNative.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export async function refreshToken() {
4343
return FronteggRN.refreshToken();
4444
}
4545

46+
/**
47+
* Starts a direct login action (e.g. a specific social provider) in the embedded login flow.
48+
*
49+
* Note on `ephemeralSession` / `additionalQueryParams`: these are currently honored on **iOS
50+
* only**. On Android the underlying native SDK's `directLoginAction` does not yet accept them,
51+
* so they are ignored there (tracked upstream in `frontegg-android-kotlin`). `ephemeralSession`
52+
* is inherently iOS-specific (it maps to the ASWebAuthenticationSession browser session).
53+
*/
4654
export async function directLoginAction(
4755
type: string,
4856
data: string,

0 commit comments

Comments
 (0)