Skip to content

Automatic Session Refresh not Working #452

Answered by jan-tennert
MatthiasKroiss asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, I'm integrating change which sets the session status back to LoadingFromStorage whenever the app goes into background. So you can collect the sessionStatus flow and change your Ui depending on the value (and it will never be Authenticated if the app just opened).
Example:

LaunchedEffect(Unit) {
    supabase.auth.sessionStatus.collect {
        when(it) {
            is SessionStatus.Authenticated -> {
                if(it.oldStatus !is SessionStatus.Authenticated) {
                    //Navigate to your app if the user is authenticated and this is the first time (so you don't navigate again on refresh)
                }
            }
            SessionStatus.LoadingFromStorage -> //

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@MatthiasKroiss
Comment options

@jan-tennert
Comment options

@MatthiasKroiss
Comment options

@jan-tennert
Comment options

Answer selected by MatthiasKroiss
@MatthiasKroiss
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants