flutter-auth-ui icon indicating copy to clipboard operation
flutter-auth-ui copied to clipboard

onSuccess on SupaSocialsAuth runs twice

Open andyngdz opened this issue 1 year ago • 1 comments

Bug report

Describe the bug

When using onSuccess callback on SupaSocialsAuth, it runs twice which leads to unexpected behaviors if want to redirect back to other screens, or trigger additional events.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Setup SupaSocialsAuth and sign in
  2. Use onSuccess callback
  3. Use print/log the session. Show twices

Expected behavior

onSuccess should call only one time after sign in successfully

System information

  • OS: macOS
  • Device: iPhone 13 Pro Max
  • supabase_auth_ui: ^0.5.4
  • Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64)

andyngdz avatar Oct 24 '24 07:10 andyngdz

I'm encountering the same issue and it's ruining my flow. basically the onSuccess runs once the page is loaded, and another time when the user clicks sign in with oauth. this results in breaking the flow (for example I have a callback that navigates to the next page when onSuccess is triggered, now the user sees the sing in page for a split of a second before they get immediately redirected to the next screen)

flutter doctor:

[✓] Flutter (Channel stable, 3.32.7, on macOS 15.4 24E248 darwin-arm64, locale
    en-SA)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] VS Code (version 1.103.2)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

pub spec:

  supabase_flutter: ^2.10.0
  supabase_auth_ui: ^0.5.5

I found a workaround by keeping a counter in my Controller and ignoring the first call to the controller

Dev-Salem avatar Sep 10 '25 21:09 Dev-Salem