I have a question. What happens in the following s...
# flutter
m
I have a question. What happens in the following scenarios (the app is exclusively on web at the moment): 1. The user leaves their system on for lets say an hour? 2. The user puts the system on sleep 3. Their system disconnects from internet for whatever reason. The user does not click anything on the website (because if they do, the browser will automatically say no internet found). Instead, the internet gets reconnected after several minutes. Would the website stay logged in? I have not put in any special mechanisms to take care of such scenarios. Do I even have to worry about these given my app is exclusively a website atm? Any suggestions for these would be welcome.
v
Depends on how long your jwt is valid. If your jwt expiry is > your time being offline. I don't think there are any issues.
m
How can I find out this jwt expiry time you mentioned?
v
under auth settings
m
thanks. Found it.
g
I don't know how Flutter gotrue client works, but on the javascript client there is an open issue on jwt expiring when mobile devices go into sleep. Basically does not matter what your jwt expire time is, it is a matter of how much is left. If you close your device when the jwt is 1 minute from expiring (say you used the app for 59 minutes since signin) and come back two minutes later the jwt will have expired and when the app starts running again, on the next supabase call you will get an expired jwt error. Because the app is not restarting, just coming back from sleep, the code does not know any time has passed so it is an ungraceful error, unless your code handles jwt errors... https://github.com/supabase/supabase/issues/6464
m
My ideal case scenario would be where the app AUTOMATICALLY redirects to the login page when the jwt token expires. As far as I know, this is not possible in flutter/dart because there is no way to get a
Stream<User?>
from the
onAuthStateChanged
method. Unless the Supabase Dart/Flutter community adds this feature, I guess we are stuck.
4 Views