Skip to content

bug: Android Web Login Flow Crashes or Fails When Using Flutter SDK with Custom Tabs #84

@PraiseJahFrancis

Description

@PraiseJahFrancis

Describe the bug

When integrating the logto_dart_sdk in a Flutter app, the sign-in flow on Android crashes or fails to complete when the signIn() method is called. This only occurs on Android and works perfectly on iOS.

The SDK attempts to launch a browser using Android Custom Tabs, but fails with: W/CustomTabsClient: Unable to find any Custom Tabs packages, you may need to add a element to your manifest.
PlatformException(CANCELED, User canceled login, null, null)
The signIn() method never completes and throws a PlatformException with the message User canceled login. Even when the redirect URL is received successfully

I put this is my manifest file





I still get errors like
W/CustomTabsClient: Unable to find any Custom Tabs packages...
PlatformException(CANCELED, User canceled login, null, null)
LogtoAuthException(LogtoAuthExceptions.isLoadingError): Already signing in...

Expected behavior

Browser opens using Custom Tabs
User logs in
App receives redirect URI
SDK successfully handles token exchange and signs in

How to reproduce?

Add logto_dart_sdk to a Flutter project.

Configure a valid redirectUri (e.g., com.example.app://callback) in the Logto dashboard and AndroidManifest.xml.
Call logtoClient.signIn() on Android.
Observe
Either the browser fails to open,
Or it opens and returns, but the SDK throws PlatformException(CANCELED, User canceled login) and logs LogtoAuthExceptions.isLoadingError: Already signing in.

Environment

Logto Cloud

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions