refactor: Combine the storage interface for storage and pkce in gotrue_client #1087
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
refactor
What is the current behavior?
The session gets stored by the supabase_flutter package by listening to auth events. The session is stored in a different place than the pkce token.
What is the new behavior?
The gotrue package manages the session storage itself (like in supabase-js) and uses the same interface as the pkce token.
Reasons for this pr:
persistSession
field, which is now used to explicitly turn on the session broadcasting. close Version 2.7.0 prevents reading data on web under certain conditions #1085I deprecated both
localStorage
(used for session storage bysupabase_flutter
) andpkceAsyncStorage
(used bysupabase
to store the pkce token) and replace them with a unified storage interfaceasyncStorage
, which uses theGotrueAsyncStorage
class, which was previsouly used for pkce only. To support existing configuration I created a new class, which combines both deprecated interfaces into one and decides by the suffix of the storage key to use the session storage or pkce storage.Additionally, I noticed that many document comments were outdated, because of the 'new' options classes for each package, so I updated them.
Additional context