Supabase Login – Refresh Token Not Working for Long-Duration Sessions #221
Unanswered
NallaMuthu-VRDev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team, I’m facing an issue with Supabase authentication in my Unity project. According to the docs, a refresh token should keep the user logged in for 30 days, but in my app the session becomes invalid after about 3 hours.
My scenario
Logged in last night around 8 PM
Session saved to PlayerPrefs through a custom UnitySupabaseSessionHandler
This morning around 11 AM, when reopening the app, RetrieveSessionAsync() returned null
It looks like the refresh token failed to refresh the access token, even though AutoRefreshToken = true is enabled
Setup
var options = new SupabaseOptions
{
AutoConnectRealtime = false,
AutoRefreshToken = true,
SessionHandler = new UnitySupabaseSessionHandler()
};
Session saving and loading look correct based on logs, but after a long gap (3–15 hours), Supabase returns no active session.
My questions
Is this a known issue with the C# SDK, refresh token rotation, or Unity environment?
Should the 30-day refresh token consistently allow reconnection after long inactivity?
Is additional handling required on Unity side to make long-lived sessions reliable?
I have also attached my UnitySupabaseSessionHandler.cs file as a .txt for reference.
UnitySupabaseSessionHandler.txt
Thanks in advance for any help!
Beta Was this translation helpful? Give feedback.
All reactions