Kevin
06/10/2025, 2:17 AMKevin
06/10/2025, 2:18 AM2025-06-04 - 10:24:44 Received new authenticated session [... some logs ...]
2025-06-04 11:35:10,273 [72497773] INFO - STDOUT - HTTP error code: 401
2025-06-04 11:35:10,566 [72498066] INFO - STDOUT - {"error":"Authentication required"}
in the logs there is not an event for the refresh between 10:24 - 11:35, and the user tries to send a request and it's unauthed because no token has been refreshed it's weird because there's not a failure log either, but in our collect
code
supabase.auth.sessionStatus.collect {
when(it) {
is SessionStatus.Authenticated -> {
println("Received new authenticated session.")
val user = it.session.user
if (user != null) {
println("User ID: ${user.id}")
println("User Email: ${user.email}")
println("User Identities: ${user.identities}")
println("User Metadata: ${user.userMetadata}")
}
println("Authentication Source: ${it.source}")
when (it.source) { //Check the source of the session
SessionSource.External -> println("Authenticated via External source.")
is SessionSource.Refresh -> println("Authenticated via Refresh.")
is SessionSource.SignIn -> println("Authenticated via SignIn.")
is SessionSource.SignUp -> println("Authenticated via SignUp.")
SessionSource.Storage -> println("Authenticated from Storage.")
SessionSource.Unknown -> println("Authenticated via Unknown source.")
is SessionSource.UserChanged -> println("Authenticated user changed.")
is SessionSource.UserIdentitiesChanged -> println("Authenticated user identities changed.")
SessionSource.AnonymousSignIn -> println("Authenticated via AnonymousSignIn.")
}
// Stop the HTTP server after successful authentication
stopHttpServer()
}
SessionStatus.Initializing -> println("Initializing")
is SessionStatus.RefreshFailure -> println("Refresh failure ${it.cause}")
is SessionStatus.NotAuthenticated -> {
if (it.isSignOut) {
println("User signed out")
} else {
println("User not signed in")
}
}
}
}
there are no logs in between of any print statements from the code snippet above. this makes me think that no event is being collected? so maybe the token isnt being refreshed at all? is this a possibility that somehow the token refresh isnt being called at all? maybe I'm not even logging the right thing, is there a way to get more in depth logs related to token refreshing? Thank you!Jan
06/10/2025, 9:51 AM