Skip to content

Error: GotrueError(message: Invalid Refresh Token, statusCode: 400) #171

Closed

Description

dependencies:
supabase_flutter: ^1.0.0-dev.3

When token expired, Supabase.initialize get error.

Flutter Web Bootstrap: Programmatic
***** Supabase init completed Instance of 'Supabase'
Got object store box in database supabase_authentication.
XMLHttpRequest error.
***** SupabaseDeepLinkingMixin startAuthObserver
Error: Unexpected null value.

Activity

  1. dshukertjr commented on Aug 9, 2022

    @dshukertjr
    Member

    Hi @raphache

    Thanks for opening an issue. Would you be able to provide some code so that I can reproduce this issue?

  2. added
    auth
    on Aug 19, 2022
  3. cspecter commented on Sep 8, 2022

    @cspecter

    I am also getting this error pretty often. For us, auth tokens are not persisting between builds or after the app is closed (if on device). Often I am seeing this error before receiving the OPs error:

    flutter: **** onAuthStateChange: AuthChangeEvent.tokenRefreshed
    [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Concurrent modification during iteration: _LinkedHashMap len:66.
    #0      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:619:9)
    #1      GoTrueClient._notifyAllSubscribers (package:gotrue/src/gotrue_client.dart:505:25)
    #2      GoTrueClient._callRefreshToken (package:gotrue/src/gotrue_client.dart:485:7)
    <asynchronous suspension>

    Whenever the magic link is used we also see some flavor of this:

    flutter: Concurrent modification during iteration: _LinkedHashMap len:14.

    We are using an email magic link for sign in. I can provide code if needed.

  4. dshukertjr commented on Sep 28, 2022

    @dshukertjr
    Member

    Sorry for the late reply here. @cspecter it would be great if you could provide some code for us to be able to reproduce this.

  5. topperspal commented on Mar 1, 2023

    @topperspal

    I am also getting this error. This error occurs because of bad token storage.

    In my case, I am developing app for windows named App_1 using supabase, so it store auth token at C:\Users\{USER}\Documents\auth\supabase_authentication.hive. So if I switch to App_2, it will also try to find valid auth token from the same path, that is not valid for this app, that's why the error occurs.

  6. dshukertjr commented on Apr 9, 2024

    @dshukertjr
    Member

    We have shipped an update that will hopefully make things better with this issue. If you could try out v2.5.0 of supabase_flutter and see if things are better, that would be great.

  7. iosephmagno commented on Sep 4, 2024

    @iosephmagno
    Contributor

    @dshukertjr hello, pasting this also here coz seems related. Wrote also to support. As mentioned, with users being kicked off, we cannot ship our product. Please LMK if/how we can help further with this. It would be also helpful if a workaround could be provided until a final fix is made, we suggested one but anything that lets client recover from login exceptions would be appreciated.
    #930

  8. dshukertjr commented on Feb 10, 2025

    @dshukertjr
    Member

    I'm closing this issue as numerous fixes to mitigate the error have been shipped since the issue was opened.

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

    auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions