Skip to content

signInWithWebUI (Android): spurious immediate UserCancelledException #7015

Description

@evgeniy-yanev

Description

Some signInWithWebUI calls on Android fail with UserCancelledException well under 2 seconds after launch — before the Hosted UI page can render, so no user action is possible. Lifecycle telemetry (Sentry breadcrumbs) shows the app backgrounded for as little as 420–480ms before the cancel trampoline (AmplifyAuthCognitoPlugin.onActivityResult → CUSTOM_TAB_CANCEL_EXTRA intent → cancelCurrentOperation) brings the activity back to the foreground and the call fails with HostedUiException.CANCELLED.

Why we believe this is a race in the cancel detection rather than a configuration issue:

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

Not deterministically reproducible (timing race). Observed in production on Samsung, Pixel, and Motorola devices, Android 10–16, always with the same signature: app backgrounds for <1.5s, returns without user interaction, signInWithWebUI throws UserCancelledException. One suggestive variant: call signOut() (which opens the /logout Custom Tab), then promptly signInWithWebUI(provider: AuthProvider.google).

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.41.5,

Amplify Flutter Version

2.6.5

Deployment Method

Custom Pipeline

Schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to the Auth CategorybugSomething is not working; the issue has reproducible steps and has been reproduced

    Type

    No type

    Fields

    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