SupabaseS
Supabase3mo ago
civomt

How to handle session storage with CMP

Hi there!

We started to use supabase-kt library in our Kotlin Multiplatform Project.

I am trying to find a bit more information about how the auth works behind the scenes.

Here is our useCase:
  • When user opens the app, they are either redirected to Auth page or Login. This is based on the session status check obtained from the supabase sdk.
We are listening and collecting auth.sessionStatus in ViewModel which updates our state (simple flag if the user is logged in or not).

My questions are:
  • How is the supabase sdk handling the session storage and its persistance, can/should this be configured?
If the application is longer than few minutes offline (no internet), the session status is is set to SessionStatus.RefreshFailure. This results in user log-out even though they never logged out manually. User is logged back when they are back online.

  • How often is the sessionStatus flow emitted?
It seems like when the SessionStatus.Refresh failure is returned, it will try to refresh every 10s. Can this be configured somewhere?

  • Do I need to do any token validation manually? - Such as saving token and refreshing it.
Thank you!

I would also appreciate some instructive resources related deeper understanding of the supabase-kt library.
Was this page helpful?