Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Aug 8, 2022 · 8 comments
Open

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

ghost opened this issue Aug 8, 2022 · 8 comments
Labels
auth This issue or pull request is related to authentication

Comments

@ghost
Copy link

ghost commented Aug 8, 2022

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.

@dshukertjr
Copy link
Member

Hi @raphache

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

@ghost
Copy link
Author

ghost commented Aug 15, 2022

Hi,
This happings when run only first time, in debug mode, at vscode.
In this case I need remove browser cookie, and it works.

More info:
Platform: Web

***** SupabaseAuthState handleDeeplink http://localhost:3000/#/
onReceivedAuthDeeplink uri: http://localhost:3000/#/
No access_token detected.
GoTrueException(message: Invalid Refresh Token, statusCode: 400)
Error: GoTrueException(message: Invalid Refresh Token, statusCode: 400)

@ghost
Copy link
Author

ghost commented Aug 18, 2022

Hi,
I don't know if you did anything, but now its working.

@bdlukaa bdlukaa added the auth This issue or pull request is related to authentication label Aug 19, 2022
@cspecter
Copy link

cspecter commented Sep 8, 2022

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.

@dshukertjr
Copy link
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.

@topperspal
Copy link

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.

@dshukertjr
Copy link
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.

@iosephmagno
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth This issue or pull request is related to authentication
Projects
None yet
Development

No branches or pull requests

5 participants