Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(supabase_flutter): session migration from hive to sharedPreferences now works properly #731

Merged
merged 3 commits into from
Nov 25, 2023

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

We have a MigrationLocalStorage class for anyone migrating from supabase_flutter v1 to v2 so that the auth session would keep working while we have switched from using hive to using sharedPreferences for storing session data.

There is currently a bug where the migration fails. This PR fixes the failing migration.

Comment on lines +199 to +200
final session =
Session.fromJson(jsonDecode(accessToken!)['currentSession']);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the format of the session string stored on local storage for v1. Note that the session object is wrapped in a currentSession key.
https://github.com/supabase/supabase-flutter/blob/main/packages/gotrue/lib/src/types/session.dart#L81

@dshukertjr dshukertjr merged commit c81cf07 into next Nov 25, 2023
2 checks passed
@dshukertjr dshukertjr deleted the fix/auth-migration branch November 25, 2023 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants