Skip to content

fix(gotrue)!: assert asyncStorage is provided for PKCE flow in the constructor#1489

Open
gourabsingha1 wants to merge 1 commit into
supabase:v3from
gourabsingha1:fix/assert-async-storage-constructor-1446
Open

fix(gotrue)!: assert asyncStorage is provided for PKCE flow in the constructor#1489
gourabsingha1 wants to merge 1 commit into
supabase:v3from
gourabsingha1:fix/assert-async-storage-constructor-1446

Conversation

@gourabsingha1

Copy link
Copy Markdown
Contributor

Root cause
When flowType is AuthFlowType.pkce (the default) and no asyncStorage is provided, calling getOAuthSignInUrl() or getLinkIdentityUrl() fails late at call time. To provide a better developer experience and fail fast, the misconfiguration should be validated up front in the constructor.

Fix
Added an assert in the GoTrueClient constructor to validate that asyncStorage != null if flowType == AuthFlowType.pkce.

Tests

  • Added a unit test in gotrue/test/client_test.dart to verify that GoTrueClient throws an AssertionError if asyncStorage is missing when using PKCE flow.
  • Updated all test suites in gotrue and supabase packages to pass a mock storage or specify implicit flow type where no storage was configured.

Fixes #1446

@gourabsingha1 gourabsingha1 requested a review from a team as a code owner June 28, 2026 08:29
@Vinzent03

Copy link
Copy Markdown
Collaborator

As stated in your linked issue this is considered as a breaking change so won't plan this for main yet but later for v3 when we start actively working on it.

@spydon spydon changed the title fix(gotrue): assert asyncStorage is provided for PKCE flow in the constructor fix(gotrue)!: assert asyncStorage is provided for PKCE flow in the constructor Jun 29, 2026
@spydon spydon changed the base branch from main to v3 June 29, 2026 14:12
@spydon spydon added the v3 label Jun 29, 2026
@spydon spydon deleted the branch supabase:v3 July 7, 2026 07:42
@spydon spydon closed this Jul 7, 2026
@spydon spydon reopened this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert asyncStorage is provided for PKCE flow in the GoTrue client constructor

3 participants