Skip to content

Android: Plaid Link session lost after process death during OAuth #170

Description

@evgeniy-yanev

When a user authenticates with their bank via OAuth, the app opens Chrome. While Chrome is in the foreground, Android can kill the app to free memory. When the user finishes in Chrome and returns, the app cold-starts and the entire Plaid Link session is lost — no success callback, no exit callback, nothing.

Root cause

The Android plugin uses the legacy Plaid.create() + PlaidHandler.open() + onActivityResult pattern. This does not survive Android process death because the PlaidHandler instance and LinkResultHandler are held in memory and lost when the process is killed.

The native Plaid Android SDK provides FastOpenPlaidLink — an ActivityResultContract that integrates with AndroidX saved-state restoration and is designed to handle process death. The plugin should be updated to use this modern pattern instead of the legacy one.

Evidence

Dart layer (plaid_method_channel.dart:59-64): Calls _channel.invokeMethod('resumeAfterTermination', ...) — sends the method call to native.

iOS (PlaidFlutterPlugin.m:60-61, 236-245): Handles "resumeAfterTermination" in the method call switch → calls [_linkHandler resumeAfterTermination:redirectUriURL] on the native Plaid SDK. Fully implemented.

Android (PlaidFlutterPlugin.java:122-138): The onMethodCall switch handles "create", "open", "close", "submit"no case for "resumeAfterTermination". Falls through to default: result.notImplemented().

However, even adding resumeAfterTermination to the Android side wouldn't help — the native Android Plaid SDK doesn't expose an equivalent method. The proper fix is migrating from the legacy pattern to FastOpenPlaidLink / ActivityResultContract.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions