Repository navigation
fix(auth)!: throw when a client has no asyncStorage for the pkce flow - #1971
Merged
spydon merged 1 commit intoOct 16, 2026
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
spydon
deleted the
lukasklingsbo/sdk-2259-v3-clearer-error-when-supabaseclienturl-key-has-no
branch
October 16, 2026 13:01
spydon
added a commit
that referenced
this pull request
Oct 16, 2026
…1972) Follow-up to #1971 for [SDK-2259](https://linear.app/supabase/issue/SDK-2259). ## Changes - `SupabaseClient` now also catches `persistSession: true` without an `asyncStorage` up front, with its own message pointing at `authOptions` or `persistSession: false`. Before, that case fell through to the `AuthClient` message, which doesn't mention `SupabaseClient`, after the default HTTP client had already been created. - Removes the JSON codec dispose before the throw. `YAJsonIsolate` doesn't spawn a long-lived isolate, so there was nothing to clean up. - The `supabase` web example and the second client in the realtime room integration test now pass a `MemoryAuthAsyncStorage`. Since #1971, both throw when they are created. - Adds tests for the persisted-session error and for the `AuthException` from `exchangeCodeForSession` on an implicit-flow client without a storage. - Updates the `SupabaseClient` dartdoc and the MIGRATION.md section to match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes SDK-2259.
Problem
A plain
SupabaseClient(url, key)uses the pkce flow without anasyncStorage. TheAuthClientconstructor guarded this with an assert, which causes two problems:dart runand AOT builds skip asserts, so they fail later at the first pkce call with a null check error, far from the cause.supabase_authand doesn't say the fix belongs in theSupabaseClientconstructor.Changes
SupabaseClientchecks itsauthOptionsbefore it builds anything else and throws anArgumentError. The message names the fix (authOptions: AuthClientOptions(asyncStorage: MemoryAuthAsyncStorage())or the implicit flow). When the code runs inside apackage:testtest, found through the#test.invokerzone value, the message also points totestSupabaseClientfromsupabase_test. The JSON isolate the client already spawned is disposed before the throw.AuthClientthrows anArgumentErrorinstead of asserting, for both the pkce case andpersistSessionwithout a storage. Debug and release builds now fail the same way.exchangeCodeForSessionthrows anAuthExceptioninstead of asserting when there is no verifier store. This can still happen with the implicit flow and no storage.SupabaseClientwith a third-partyaccessTokenno longer builds anAuthClientat all, sincesupabase.authalready throws in that mode. Without this, such clients would start throwing in release builds.asyncStorage, also listed under the changes the compiler won't catch.Breaking change
A client created without an
asyncStorageunder the pkce flow used to build fine in release builds. It now throws at construction.