Closed jacobian2020 closed 1 month ago
Thanks for the issue, will publish a fix later!
make it configurable for now to ignore at least 503s as this will be returned by most webservers if server is having issues/under load etc
Just to make sure, if the refresh fails with such a status code, what exactly should happen? Should the exception just be silently ignored (which causes auto refresh to stop essentially until restart), or should the client retry refreshing after AuthConfig#retryDelay
?
I'd assume the latter, prepared a PR #725
General Info
Version(s)
2.6.1
Kotlin Target(s) and their respective versions
JVM 17 Android 14
What happened? (include your code)
When backend is unavailable (503), UserSession is deleted.
Offending line is at https://github.com/supabase-community/supabase-kt/blob/246fe23ebe590f7346b4590107d200fb62947c25/GoTrue/src/commonMain/kotlin/io/github/jan/supabase/gotrue/AuthImpl.kt#L438
Our corporate reverse proxy returned 503 due to supabase backend being unavailable and it logged out all our users due to a background job that retried to upload images when users were not even using the app.
Suggestions: Please don't clear the session for all http error codes. Only clear it when refresh returns 401 due to the token being incorrect. If your backend does not support this, make it configurable for now to ignore at least 503s as this will be returned by most webservers if server is having issues/under load etc. At it's current state this is unusable in production for us.
Steps To Reproduce (optional)
Relevant log output (optional)