Skip to content

Commit 2ef3974

Browse files
fix(capacitor): don't log out on Android refresh failure; resolve {success} (FR-25946)
android FronteggNativePlugin.refreshToken() did logout(...) whenever refreshTokenIfNeeded() returned false, so a transient network error during an app-initiated refresh destroyed the session — undocumented, destructive, and divergent from iOS (which just resolves {success:false}). Resolve { success } and leave the session intact, matching iOS.
1 parent dcfb6e5 commit 2ef3974

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

android/src/main/java/com/frontegg/ionic/FronteggNativePlugin.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,13 @@ public void refreshToken(PluginCall call) {
286286
executor.submit(() -> {
287287
Handler handler = new Handler(Looper.getMainLooper());
288288
FronteggAuth fronteggAuth = FronteggAppKt.getFronteggAuth(this.getContext());
289-
if (!fronteggAuth.refreshTokenIfNeeded()) {
290-
fronteggAuth.logout(() -> {
291-
handler.post(call::resolve);
292-
return null;
293-
});
294-
} else {
295-
handler.post(call::resolve);
296-
}
289+
// FR-25946: previously a failed refresh (e.g. a transient network blip during an
290+
// app-initiated refreshToken()) logged the user out — destructive and divergent from
291+
// iOS. Resolve { success } instead and leave the session intact, matching iOS.
292+
boolean success = fronteggAuth.refreshTokenIfNeeded();
293+
JSObject result = new JSObject();
294+
result.put("success", success);
295+
handler.post(() -> call.resolve(result));
297296
});
298297
}
299298

0 commit comments

Comments
 (0)