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

Sentry reports AuthException(message: Invalid Refresh Token: Refresh Token Not Found, statusCode: 400) #930

Open
RCVZ opened this issue May 14, 2024 · 8 comments
Labels
auth This issue or pull request is related to authentication bug Something isn't working

Comments

@RCVZ
Copy link

RCVZ commented May 14, 2024

Describe the bug
Sentry reports a couple of AuthException's
All of the reports are on iOS(But those are like 99% of my users)

To Reproduce
I have not been able to reproduce this with one of my own devices.

Version:
supabase_flutter 2.5.2
supabase 2.1.2
functions_client 2.1.0
gotrue 2.6.1
postgrest 2.1.1
realtime_client 2.0.4
storage_client 2.0.1

Additional context

AuthException(message: Invalid Refresh Token: Refresh Token Not Found, statusCode: 400)
  App                 0x10bb1abd4  GoTrueClient.notifyException (gotrue_client.dart:1206)
  App                 0x10bd5c604  GoTrueClient.recoverSession (gotrue_client.dart:995)
  File "<asynchronous suspension>"
  App                 0x10bd5c32c  SupabaseAuth.recoverSession (supabase_auth.dart:90)
  File "<asynchronous suspension>"
  App                 0x10bb1aa3c  CancelableCompleter.complete.<T> (cancelable_operation.dart:427)
@RCVZ RCVZ added the bug Something isn't working label May 14, 2024
@dshukertjr
Copy link
Member

Duplicate of #928

@dshukertjr dshukertjr marked this as a duplicate of #928 May 14, 2024
@RCVZ
Copy link
Author

RCVZ commented May 14, 2024

@dshukertjr This is not a duplicate! This error states refresh token not found.

@dshukertjr dshukertjr added the auth This issue or pull request is related to authentication label May 14, 2024
@dshukertjr
Copy link
Member

@RCVZ Next time when you open an issue, you can give the issue a more descriptive name so that it does not look like a duplicate.

@dshukertjr dshukertjr reopened this May 14, 2024
@RCVZ RCVZ changed the title Sentry reports AuthException Sentry reports AuthException(Invalid Refresh Token: Refresh Token Not Found) May 14, 2024
@RCVZ RCVZ changed the title Sentry reports AuthException(Invalid Refresh Token: Refresh Token Not Found) Sentry reports AuthException(message: Invalid Refresh Token: Refresh Token Not Found, statusCode: 400) May 14, 2024
@dshukertjr
Copy link
Member

Thanks for updating the title!

@Donaldd
Copy link

Donaldd commented May 18, 2024

I've been getting the same issue. User is suddenly logged out of the app and then we get this error message (see below) from Sentry.
Screenshot 2024-05-17 at 7 06 32 PM

@devj3ns
Copy link

devj3ns commented Jul 4, 2024

I get the same exception when I reopen my web app where I was previously logged in after a longer period of time. I am currently catching this error from the onAuthStateChange Stream but I am not sure how to handle it. When I reload the web-app, the user is logged out and everything works fine.

After digging into the _callRefreshToken method in the GoTrue client I found out that the user is automatically signed out on every AuthException which is not a AuthRetryableFetchException. There is also a test to ensure that the user is logged out when the refresh token is invalid.

In my app, even though I see the **** onAuthStateChange: AuthChangeEvent.signedOut log in my console when the "Invalid Refresh Token" exception is thrown, I don't receive the AuthChangeEvent.signedOut event when listening to the onAuthStateChange, instead I receive the exception and have to handle it in some way. Currently, I sign out the user manually, which seems to work.

@dshukertjr What is the preferred way to handle this exception?

I found some more information about this exception here:

@RCVZ
Copy link
Author

RCVZ commented Jul 25, 2024

@dshukertjr When is this issue going to be fixed? 3 months have already passed!

@RCVZ
Copy link
Author

RCVZ commented Aug 13, 2024

@dshukertjr ???

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 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants