Authentication persistence issues when upgrading Supabase Flutter from v1 to v2
I want to ensure that users only need to log in the first time after downloading my mobile app, and save their user sessions so they don't need to re-authenticate every single time they open the app.
Previously on v1.10.0 of the
Now that I have upgraded my Flutter and Supabase versions to the latest stable (v2),
I've seen in the docs (https://supabase.com/docs/reference/dart/upgrade-guide) you can check if a session is expired with
but it seems like there isn't/ I shouldn't need to cache my session in v2. When I close and reopen the app I do not have an auth token anymore.
I am initializing in main as so:
Any help much appreciated, thanks!
Previously on v1.10.0 of the
supabase_flutter package (https://pub.dev/packages/supabase_flutter) I was able to make my authentication persist by storing the sessionString and recovering it when necessary with recoverSession:Now that I have upgraded my Flutter and Supabase versions to the latest stable (v2),
persistSessionString is deprecated and I'm struggling to figure out how to get my authentication tokens to persist.I've seen in the docs (https://supabase.com/docs/reference/dart/upgrade-guide) you can check if a session is expired with
but it seems like there isn't/ I shouldn't need to cache my session in v2. When I close and reopen the app I do not have an auth token anymore.
I am initializing in main as so:
Any help much appreciated, thanks!
Dart packages
Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.