Skip to content

bug: signIn() call from logto_dart_sdk fails on iOS PWA due to asynchronous popup blocking in Safari #83

Description

@anchevalier

Describe the bug

When using logto_dart_sdk in a Flutter web application, calling signIn() opens a login popup window. This works as expected on most platforms.

However, when running the app as a Progressive Web App (PWA) on iOS, clicking the login button fails to open the popup window. This is caused by Safari's platform restriction, which blocks popups that are not triggered synchronously by a direct user action.

Since signIn() is an async method, the popup is triggered after a delay (within a Future), and is therefore blocked by Safari. This makes login via Logto impossible in iOS PWA environments.

Expected behavior

When the user taps the "Sign in" button in a Flutter web app running as a PWA on iOS:

  1. A login popup window should open immediately.
  2. The user should be redirected to the Logto login page inside that popup.
  3. After successful authentication, the flow should continue as expected (redirect + token handling).

This entire flow currently fails because the popup is blocked at step 1.

How to reproduce?

  1. Create a minimal Flutter web app.
  2. Add logto_dart_sdk and follow the official documentation to configure login.
  3. Build the app for web.
  4. Install the app as a PWA on an iOS device (iPhone or iPad) using Safari.
  5. Tap the login button in the app.

Observed result:
No popup opens, or the popup is blocked. Login cannot proceed.

Environment

Self-hosted (Docker image)

Screenshots

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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