Hello! I’m using Supabase in my React Native app. ...
# help
a
Hello! I’m using Supabase in my React Native app. We’re struggling with the async storage issue outlined here https://github.com/supabase/gotrue-js/issues/143#issuecomment-970288835 – specifically, we need a good way to distinguish whether supabase.auth.user() is null because there is no session, or if it is null because we are waiting for the token to refresh. This is a fairly consistent problem whenever the token expires while the app is in background – on app launch, we have indeterminate behavior as to whether the user is null, because it loads async from AsyncStorage. The only options I have been able to think of are to introduce a delay on app launch for any network dependent logic, or to modify gotrue-js to expose some sort of “is refreshing” state. I know that I can subscribe to the listener when the Auth State changes on refresh, but for cases where it’s determining logged in/logged out behavior, I would rather not flash the login screen if possible. Curious if there are any other suggestions – thanks!
n
Hello @abaum! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
a
as one quick follow up – I saw the supabase/ui solution here: https://github.com/supabase/ui/pull/269 though we aren't using that library for our state management. I think the underlying issue described is still a good one, and I was curious if there are any follow-ups happening there.
l
I have created a PR to add an async function to solve a similiar problem (session null on page load while token refreshing): https://github.com/supabase/gotrue-js/pull/265
n
abaum (2022-04-23)
l
But I have not received any feedback so far.
a
that would be a big help – will follow along on that PR as well.
2 Views