Skip to content

Android: expose WebAuthProvider.addCallback for process-death recovery #1541

@hamed17n

Description

@hamed17n

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

Summary

The underlying com.auth0.android:auth0 SDK exposes a static
WebAuthProvider.addCallback(Callback<Credentials, AuthenticationException>) API. When
the Android OS kills the host process while Chrome Custom Tabs is open, the SDK can
still complete the PKCE token exchange on process restart and notify registered
callbacks. react-native-auth0 does not expose this callback to JavaScript, so React
Native apps have no way to recover credentials from a post-process-death login without
bridging the native API themselves.

Impact

On devices with aggressive memory management (common on Samsung One UI), this affects
a meaningful share of users who attempt login. The user completes their credentials in
the browser, the SDK finishes the token exchange, but the JS layer is unaware — the app
re-renders at the login screen.

Describe the ideal solution

What we'd like

A JS-accessible method — something like:

auth0.webAuth.resumeSession(): Promise<{
  success: true;
  credentials: Credentials;
} | {
  success: false;
  errorCode: string;
} | null>;

Called once on cold start (gated on an in-flight attempt marker), it drains any pending post-kill result from the SDK callback and returns the credentials or error to JS.

Alternatives and current workarounds

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA feature has been asked for or suggested by the community

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions