Replies: 1 comment 1 reply
-
Have you tried out printing the session status directly after signing out / signing? Then we would see if the value was at least changed. Maybe it's a collecting coroutine issue |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Description:
I’m using Supabase Authentication with Kotlin Multiplatform and Native UIs, and I’m facing an issue where the
SessionStatus
updates fromStateFlow
are not being emitted after the initial session status is fetched at the app start. Specifically, after signing in or signing out, the session status does not emit any further updates.I have set up a
SharedViewModel
class to manage state updates in the view model, but after calling authentication methods likesignInWithIdToken()
orsignOut()
, I am not receiving updates onsessionStatus
in my flow.Expected Behavior:
Authenticated
toNotAuthenticated
), thesessionStatus
StateFlow
should emit updates.Actual Behavior:
StateFlow
does not emit new session states (e.g., after callingsignOut()
orsignInWithIdToken()
).I believe the session status flow might not be refreshing correctly after the session changes.
Code Overview:
Here is the relevant code I’ve implemented in my app.
1. SupabaseAuthService
The
SupabaseAuthService
handles authentication logic and exposes theStateFlow<SessionStatus>
that tracks session status changes.2. AppUseCase
The
AppUseCase
interacts with the repository and provides methods to observe session state and authentication status.3. SharedViewModel
The
SharedViewModel
class manages the state and provides functions to update the state, launch coroutines, and clear resources when necessary.4. AppViewModel
The
AppViewModel
collects updates from sessionState() and updates the UI state accordingly.Steps to Reproduce:
Troubleshooting:
Questions:
Beta Was this translation helpful? Give feedback.
All reactions