supabase-swift: "Refresh Token Not Found" = automatic logout after 2-3 days after login
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
About 2-3 days after logging in, the user gets automatically logged out (we are using the OTP login and use the API on iOS and macOS). Checking the error messages, we see:
api(Auth.AuthError.APIError(msg: nil, code: nil, error: Optional("invalid_grant"), errorDescription: Optional("Invalid Refresh Token: Refresh Token Not Found"), weakPassword: nil))
To Reproduce
Using the Swift API of Supabase, login, use the app for 2-3 days and you will get logged out.
Expected behavior
User should stay logged in indefinitely or as per the settings (see additional information).
System information
- OS: macOS, iOS
- Version of supabase-swift: 2.15.2
Additional context
We have tried to increase the rate limits: Token Refreshes = 184 Token Verifications = 100 Sign ups and sign ins = 50 Time-box user sessions = 0 Inactivity timeout = 0 Access Tokens expiry time = 10800 (3 hours) Refresh token reuse interval = 30
Let me know if the settings can cause this.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 43 (5 by maintainers)
Hey 👋 Could we please bring more attention to this issue? It’s a crucial part of the core workflow for many apps, and addressing it promptly would be greatly appreciated.
@grdsdev Could you find anything? We are a bit struggling with this, or is there anything we can do temporarily to reduce the logouts?
@EduardMe I don’t think that is causing the issue, but your check is redundant, when you call the
try await supabase.auth.sessionit already validates if session is expired, if it isn’t, it returns it without refreshing, just like your firstif.Still looking at this issue…
Since the initial issue has been drastically decreased, I’ll close it.
@dpelletier2017 I’m not sure if I followed.
Once you sign in with Apple using the ID token, the session will use the refresh token to refresh it; you don’t need to update/send any ID token after that.
Could you open another issue for that if you still need help? I think this is unrelated to the initial discussion.
I am also testing 2.20.2 since it has been released.
I don’t know if it’s a placebo effect, but I also feel like I’m experiencing less logouts. I will also continue testing in the upcoming days.
I’m using it since the last couple of days and had one logout only so far. It feels like it has reduced, but need a few more days to know for sure.
@dshukertjr in my case it happens with realtime.