From 9d902a81cc193fa81feb0f3ec7510c997b006089 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 08:22:04 -0300 Subject: [PATCH 1/6] feat: rename anon key to publishable key and service role key to secret key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames all references to align with Supabase's updated key naming convention: - `anonKey` parameter → `publishableKey` in Supabase.initialize() and _init() - `supabaseAnonKey` → `supabasePublishableKey` (internal parameter) - `ANON_KEY` / `SUPABASE_ANON_KEY` → `PUBLISHABLE_KEY` / `SUPABASE_PUBLISHABLE_KEY` in examples, docs, and infra config - `service_role` key references in doc comments → `secret` key - Test variables `anonToken` → `publishableToken` in gotrue tests JWT role claims (`'role': 'service_role'`) are left unchanged as they are internal backend values unrelated to the key naming convention. Co-Authored-By: Claude Sonnet 4.6 --- AGENTS.md | 2 +- infra/storage_client/docker-compose.yml | 2 +- .../lib/src/functions_client.dart | 2 +- packages/gotrue/lib/src/gotrue_admin_api.dart | 8 ++++---- .../lib/src/gotrue_admin_oauth_api.dart | 12 +++++------ packages/gotrue/test/client_test.dart | 16 +++++++-------- packages/gotrue/test/get_claims_test.dart | 10 +++++----- packages/gotrue/test/provider_test.dart | 6 +++--- .../gotrue/test/src/gotrue_mfa_api_test.dart | 6 +++--- packages/supabase/CHANGELOG.md | 2 +- packages/supabase/example/web/main.dart | 2 +- packages/supabase_flutter/CHANGELOG.md | 8 ++++---- packages/supabase_flutter/README.md | 2 +- .../supabase_flutter/example/lib/main.dart | 2 +- .../supabase_flutter/lib/src/supabase.dart | 10 +++++----- packages/supabase_flutter/test/auth_test.dart | 8 ++++---- .../supabase_flutter/test/deep_link_test.dart | 2 +- .../test/initialization_test.dart | 20 +++++++++---------- .../supabase_flutter/test/lifecycle_test.dart | 2 +- .../test/supabase_flutter_test.dart | 12 +++++------ .../supabase_flutter/test/widget_test.dart | 2 +- 21 files changed, 68 insertions(+), 68 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 9f8e43278..765829154 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -196,7 +196,7 @@ For integration testing, you may want to point to a local Supabase instance: ```dart await Supabase.initialize( url: 'http://localhost:54321', - anonKey: 'your-local-anon-key', + publishableKey: 'your-local-publishable-key', ); ``` diff --git a/infra/storage_client/docker-compose.yml b/infra/storage_client/docker-compose.yml index 44b31189b..a3a39477a 100644 --- a/infra/storage_client/docker-compose.yml +++ b/infra/storage_client/docker-compose.yml @@ -22,7 +22,7 @@ services: condition: service_healthy restart: always environment: - ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.ReNhHIoXIOa-8tL1DO3e26mJmOTnYuvdgobwIYGzrLQ + PUBLISHABLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.ReNhHIoXIOa-8tL1DO3e26mJmOTnYuvdgobwIYGzrLQ SERVICE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.FhK1kZdHmWdCIEZELt0QDCw6FIlCS8rVmp4RzaeI2LM PROJECT_REF: bjwdssmqcnupljrqypxz # can be any random string REGION: us-east-1 # region where your bucket is located diff --git a/packages/functions_client/lib/src/functions_client.dart b/packages/functions_client/lib/src/functions_client.dart index 3f54b79bb..a5f1e6c2f 100644 --- a/packages/functions_client/lib/src/functions_client.dart +++ b/packages/functions_client/lib/src/functions_client.dart @@ -83,7 +83,7 @@ class FunctionsClient { /// final fetchClient = FetchClient(mode: RequestMode.cors); /// await Supabase.initialize( /// url: supabaseUrl, - /// anonKey: supabaseKey, + /// publishableKey: supabaseKey, /// httpClient: fetchClient, /// ); /// ``` diff --git a/packages/gotrue/lib/src/gotrue_admin_api.dart b/packages/gotrue/lib/src/gotrue_admin_api.dart index 42b5a79e5..5e25ec8bf 100644 --- a/packages/gotrue/lib/src/gotrue_admin_api.dart +++ b/packages/gotrue/lib/src/gotrue_admin_api.dart @@ -59,7 +59,7 @@ class GoTrueAdminApi { /// Creates a new user. /// - /// This function should only be called on a server. Never expose your `service_role` key on the client. + /// This function should only be called on a server. Never expose your `secret` key on the client. /// /// Requires either an email or phone Future createUser(AdminUserAttributes attributes) async { @@ -75,11 +75,11 @@ class GoTrueAdminApi { return UserResponse.fromJson(response); } - /// Delete a user. Requires a `service_role` key. + /// Delete a user. Requires a `secret` key. /// /// [id] is the user id of the user you want to remove. /// - /// This function should only be called on a server. Never expose your `service_role` key on the client. + /// This function should only be called on a server. Never expose your `secret` key on the client. Future deleteUser(String id) async { validateUuid(id); final options = GotrueRequestOptions(headers: _headers); @@ -92,7 +92,7 @@ class GoTrueAdminApi { /// Get a list of users. /// - /// This function should only be called on a server. Never expose your `service_role` key on the client. + /// This function should only be called on a server. Never expose your `secret` key on the client. /// /// The result is paginated. Use the [page] and [perPage] parameters to paginate the result. Future> listUsers({int? page, int? perPage}) async { diff --git a/packages/gotrue/lib/src/gotrue_admin_oauth_api.dart b/packages/gotrue/lib/src/gotrue_admin_oauth_api.dart index afb07891a..e9a27a2ce 100644 --- a/packages/gotrue/lib/src/gotrue_admin_oauth_api.dart +++ b/packages/gotrue/lib/src/gotrue_admin_oauth_api.dart @@ -65,7 +65,7 @@ class GoTrueAdminOAuthApi { /// Lists all OAuth clients with optional pagination. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future listClients({ int? page, int? perPage, @@ -88,7 +88,7 @@ class GoTrueAdminOAuthApi { /// Creates a new OAuth client. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future createClient( CreateOAuthClientParams params, ) async { @@ -107,7 +107,7 @@ class GoTrueAdminOAuthApi { /// Gets details of a specific OAuth client. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future getClient(String clientId) async { validateUuid(clientId); @@ -125,7 +125,7 @@ class GoTrueAdminOAuthApi { /// Updates an existing OAuth client. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future updateClient( String clientId, UpdateOAuthClientParams params, @@ -147,7 +147,7 @@ class GoTrueAdminOAuthApi { /// Deletes an OAuth client. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future deleteClient(String clientId) async { validateUuid(clientId); @@ -165,7 +165,7 @@ class GoTrueAdminOAuthApi { /// Regenerates the secret for an OAuth client. /// Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. /// - /// This function should only be called on a server. Never expose your `service_role` key in the browser. + /// This function should only be called on a server. Never expose your `secret` key in the browser. Future regenerateClientSecret(String clientId) async { validateUuid(clientId); diff --git a/packages/gotrue/test/client_test.dart b/packages/gotrue/test/client_test.dart index 546c9b2ad..799741818 100644 --- a/packages/gotrue/test/client_test.dart +++ b/packages/gotrue/test/client_test.dart @@ -17,7 +17,7 @@ void main() { env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; + final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; late String newEmail; late String newPhone; @@ -40,7 +40,7 @@ void main() { client = GoTrueClient( url: gotrueUrl, - headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, + headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -57,7 +57,7 @@ void main() { clientWithAuthConfirmOff = GoTrueClient( url: gotrueUrl, httpClient: NoEmailConfirmationHttpClient(), - headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, + headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -274,7 +274,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': anonToken}, + headers: {'apikey': publishableToken}, ); expect(newClient.currentSession?.refreshToken ?? '', isEmpty); @@ -305,7 +305,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': anonToken}, + headers: {'apikey': publishableToken}, ); expect(newClient.currentSession, isNull); @@ -348,7 +348,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': anonToken}, + headers: {'apikey': publishableToken}, ); // Should fall back to _callRefreshToken and succeed. @@ -399,7 +399,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': anonToken}, + headers: {'apikey': publishableToken}, ); expect(newClient.currentSession, isNull); @@ -541,7 +541,7 @@ void main() { final httpClient = RetryTestHttpClient(); final client = GoTrueClient( url: gotrueUrl, - headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, + headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, asyncStorage: TestAsyncStorage(), httpClient: httpClient, ); diff --git a/packages/gotrue/test/get_claims_test.dart b/packages/gotrue/test/get_claims_test.dart index 6f7244e88..80cba68e9 100644 --- a/packages/gotrue/test/get_claims_test.dart +++ b/packages/gotrue/test/get_claims_test.dart @@ -10,7 +10,7 @@ void main() { env.load(); final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; + final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; group('getClaims', () { late GoTrueClient client; @@ -29,8 +29,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $anonToken', - 'apikey': anonToken, + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken, }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, @@ -216,8 +216,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $anonToken', - 'apikey': anonToken, + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken, }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, diff --git a/packages/gotrue/test/provider_test.dart b/packages/gotrue/test/provider_test.dart index e705388a7..877012205 100644 --- a/packages/gotrue/test/provider_test.dart +++ b/packages/gotrue/test/provider_test.dart @@ -11,7 +11,7 @@ void main() { env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; + final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; late GoTrueClient client; late Session session; @@ -20,8 +20,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $anonToken', - 'apikey': anonToken, + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken, }, flowType: AuthFlowType.implicit, ); diff --git a/packages/gotrue/test/src/gotrue_mfa_api_test.dart b/packages/gotrue/test/src/gotrue_mfa_api_test.dart index a7295ad8e..424241046 100644 --- a/packages/gotrue/test/src/gotrue_mfa_api_test.dart +++ b/packages/gotrue/test/src/gotrue_mfa_api_test.dart @@ -14,7 +14,7 @@ void main() { final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; + final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; late GoTrueClient client; setUp(() async { @@ -26,8 +26,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $anonToken', - 'apikey': anonToken, + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken, 'x-forwarded-for': '127.0.0.1' }, ); diff --git a/packages/supabase/CHANGELOG.md b/packages/supabase/CHANGELOG.md index 53340ab53..958c4551d 100644 --- a/packages/supabase/CHANGELOG.md +++ b/packages/supabase/CHANGELOG.md @@ -410,7 +410,7 @@ ```dart // The following will initialize a supabase client that will retry failed uploads up to 25 times, // which is about 10 minutes of retrying. - final supabase = SupabaseClient('Supabase_URL', 'Anon_key', storageRetryAttempts: 25); + final supabase = SupabaseClient('Supabase_URL', 'Publishable_key', storageRetryAttempts: 25); ``` - feat: update storage to v1.1.0 - feat: update gotrue to v1.2.0 diff --git a/packages/supabase/example/web/main.dart b/packages/supabase/example/web/main.dart index c1f2d9e71..ba5b789f0 100644 --- a/packages/supabase/example/web/main.dart +++ b/packages/supabase/example/web/main.dart @@ -5,7 +5,7 @@ import 'package:web/web.dart' as web; void main() { const supabaseUrl = 'YOUR_SUPABASE_URL'; - const supabaseKey = 'YOUR_ANON_KEY'; + const supabaseKey = 'YOUR_PUBLISHABLE_KEY'; final supabase = SupabaseClient(supabaseUrl, supabaseKey); final element = web.document.querySelector('#output') as web.HTMLDivElement; diff --git a/packages/supabase_flutter/CHANGELOG.md b/packages/supabase_flutter/CHANGELOG.md index 87711f677..b32bd267f 100644 --- a/packages/supabase_flutter/CHANGELOG.md +++ b/packages/supabase_flutter/CHANGELOG.md @@ -335,7 +335,7 @@ // Initialize Supabase with AuthFlowType.pkce to enable PKCE flow for deep link related auth await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, authFlowType: AuthFlowType.pkce, ); ``` @@ -478,7 +478,7 @@ // which is about 10 minutes of retrying. await Supabase.initialize( supabaseUrl, - supabaseAnonKey, + supabasePublishableKey, storageRetryAttempts: 25, ); ``` @@ -703,7 +703,7 @@ await Supabase.initialize( url: 'SUPABASE_URL', - anonKey: 'SUPABASE_ANON_KEY', + publishableKey: 'SUPABASE_PUBLISHABLE_KEY', ); ... @@ -719,7 +719,7 @@ class AuthState extends SupabaseAuthState { // Deep links will also be automatically handled when you initialize Supabase. await Supabase.initialize( url: 'SUPABASE_URL', - anonKey: 'SUPABASE_ANON_KEY', + publishableKey: 'SUPABASE_PUBLISHABLE_KEY', ); ... diff --git a/packages/supabase_flutter/README.md b/packages/supabase_flutter/README.md index 047545a5b..8e25305e0 100644 --- a/packages/supabase_flutter/README.md +++ b/packages/supabase_flutter/README.md @@ -27,7 +27,7 @@ void main() async { await Supabase.initialize( url: SUPABASE_URL, - anonKey: SUPABASE_ANON_KEY, + publishableKey: SUPABASE_PUBLISHABLE_KEY, ); runApp(MyApp()); diff --git a/packages/supabase_flutter/example/lib/main.dart b/packages/supabase_flutter/example/lib/main.dart index 6cd466188..bdebb8566 100644 --- a/packages/supabase_flutter/example/lib/main.dart +++ b/packages/supabase_flutter/example/lib/main.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { - await Supabase.initialize(url: 'SUPABASE_URL', anonKey: 'SUPABASE_ANON_KEY'); + await Supabase.initialize(url: 'SUPABASE_URL', publishableKey: 'SUPABASE_PUBLISHABLE_KEY'); runApp(const MyApp()); } diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index 41d1dc588..307a74180 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -52,7 +52,7 @@ class Supabase { /// This must be called only once. If called more than once, an /// [AssertionError] is thrown /// - /// [url] and [anonKey] can be found on your Supabase dashboard. + /// [url] and [publishableKey] can be found on your Supabase dashboard. /// /// You can access none public schema by passing different [schema]. /// @@ -76,7 +76,7 @@ class Supabase { /// If [debug] is set to `true`, debug logs will be printed in debug console. Default is `kDebugMode`. static Future initialize({ required String url, - required String anonKey, + required String publishableKey, Map? headers, Client? httpClient, RealtimeClientOptions realtimeClientOptions = const RealtimeClientOptions(), @@ -120,7 +120,7 @@ class Supabase { } _instance._init( url, - anonKey, + publishableKey, httpClient: httpClient, customHeaders: headers, realtimeClientOptions: realtimeClientOptions, @@ -193,7 +193,7 @@ class Supabase { void _init( String supabaseUrl, - String supabaseAnonKey, { + String supabasePublishableKey, { Client? httpClient, Map? customHeaders, required RealtimeClientOptions realtimeClientOptions, @@ -208,7 +208,7 @@ class Supabase { }; client = SupabaseClient( supabaseUrl, - supabaseAnonKey, + supabasePublishableKey, httpClient: httpClient, headers: headers, realtimeClientOptions: realtimeClientOptions, diff --git a/packages/supabase_flutter/test/auth_test.dart b/packages/supabase_flutter/test/auth_test.dart index dd53fb313..8fd422900 100644 --- a/packages/supabase_flutter/test/auth_test.dart +++ b/packages/supabase_flutter/test/auth_test.dart @@ -46,7 +46,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: mockStorage, @@ -67,7 +67,7 @@ void main() { () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -94,7 +94,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: corruptedStorage, @@ -112,7 +112,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: emptyStorage, diff --git a/packages/supabase_flutter/test/deep_link_test.dart b/packages/supabase_flutter/test/deep_link_test.dart index 0db027ac7..666b55d38 100644 --- a/packages/supabase_flutter/test/deep_link_test.dart +++ b/packages/supabase_flutter/test/deep_link_test.dart @@ -22,7 +22,7 @@ void main() { ); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, httpClient: pkceHttpClient, authOptions: FlutterAuthClientOptions( diff --git a/packages/supabase_flutter/test/initialization_test.dart b/packages/supabase_flutter/test/initialization_test.dart index 7fceeb8cb..1cf9b14fb 100644 --- a/packages/supabase_flutter/test/initialization_test.dart +++ b/packages/supabase_flutter/test/initialization_test.dart @@ -28,7 +28,7 @@ void main() { test('initialize successfully with default options', () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -41,7 +41,7 @@ void main() { final localStorage = MockLocalStorage(); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: localStorage, ), @@ -54,7 +54,7 @@ void main() { test('handles initialization with expired session in storage', () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -71,7 +71,7 @@ void main() { test('initialize successfully with PKCE auth flow', () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, authOptions: const FlutterAuthClientOptions( authFlowType: AuthFlowType.pkce, ), @@ -87,7 +87,7 @@ void main() { final httpClient = PkceHttpClient(); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, httpClient: httpClient, ); @@ -98,7 +98,7 @@ void main() { test('initialize successfully with custom access token', () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, accessToken: () async => 'custom-access-token', ); @@ -118,7 +118,7 @@ void main() { // First initialization await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -132,7 +132,7 @@ void main() { // Re-initialize should work without errors await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -141,7 +141,7 @@ void main() { test('handles multiple initializations correctly', () async { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -157,7 +157,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/lifecycle_test.dart b/packages/supabase_flutter/test/lifecycle_test.dart index edf89fb28..d94cb3c44 100644 --- a/packages/supabase_flutter/test/lifecycle_test.dart +++ b/packages/supabase_flutter/test/lifecycle_test.dart @@ -81,7 +81,7 @@ void main() { readyCompleters = []; await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/supabase_flutter_test.dart b/packages/supabase_flutter/test/supabase_flutter_test.dart index d487032e6..74ae10df8 100644 --- a/packages/supabase_flutter/test/supabase_flutter_test.dart +++ b/packages/supabase_flutter/test/supabase_flutter_test.dart @@ -14,7 +14,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -34,7 +34,7 @@ void main() { await Supabase.instance.dispose(); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -50,7 +50,7 @@ void main() { test('with custom access token', () async { final supabase = await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseUrl, + publishableKey: supabaseUrl, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -73,7 +73,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -97,7 +97,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -123,7 +123,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: localStorage, diff --git a/packages/supabase_flutter/test/widget_test.dart b/packages/supabase_flutter/test/widget_test.dart index 098efbded..5160d7ff3 100644 --- a/packages/supabase_flutter/test/widget_test.dart +++ b/packages/supabase_flutter/test/widget_test.dart @@ -17,7 +17,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - anonKey: supabaseKey, + publishableKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), pkceAsyncStorage: MockAsyncStorage(), From dfadfccf850ad5f8337409b3f1c3d3dcc1a94879 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 08:27:44 -0300 Subject: [PATCH 2/6] fix: deprecate anonKey instead of hard-removing it, revert ANON_KEY env var rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Keep anonKey as @Deprecated in Supabase.initialize() so existing callers continue to compile; they receive a deprecation warning pointing to publishableKey. An assert enforces that at least one of the two is supplied. - Revert ANON_KEY → PUBLISHABLE_KEY in docker-compose: the storage binary reads ANON_KEY by name, renaming it silently breaks the service. Co-Authored-By: Claude Sonnet 4.6 --- infra/storage_client/docker-compose.yml | 2 +- packages/supabase_flutter/lib/src/supabase.dart | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/infra/storage_client/docker-compose.yml b/infra/storage_client/docker-compose.yml index a3a39477a..44b31189b 100644 --- a/infra/storage_client/docker-compose.yml +++ b/infra/storage_client/docker-compose.yml @@ -22,7 +22,7 @@ services: condition: service_healthy restart: always environment: - PUBLISHABLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.ReNhHIoXIOa-8tL1DO3e26mJmOTnYuvdgobwIYGzrLQ + ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.ReNhHIoXIOa-8tL1DO3e26mJmOTnYuvdgobwIYGzrLQ SERVICE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.FhK1kZdHmWdCIEZELt0QDCw6FIlCS8rVmp4RzaeI2LM PROJECT_REF: bjwdssmqcnupljrqypxz # can be any random string REGION: us-east-1 # region where your bucket is located diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index 307a74180..0a97cbece 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -76,7 +76,11 @@ class Supabase { /// If [debug] is set to `true`, debug logs will be printed in debug console. Default is `kDebugMode`. static Future initialize({ required String url, - required String publishableKey, + String? publishableKey, + @Deprecated( + 'Use publishableKey instead. anonKey will be removed in a future major version.', + ) + String? anonKey, Map? headers, Client? httpClient, RealtimeClientOptions realtimeClientOptions = const RealtimeClientOptions(), @@ -86,6 +90,12 @@ class Supabase { Future Function()? accessToken, bool? debug, }) async { + assert( + publishableKey != null || anonKey != null, + 'Either publishableKey or anonKey must be provided.', + ); + final effectiveKey = publishableKey ?? anonKey!; + if (_instance._isInitialized) { _log.info('Supabase is already initialized. Skipping reinitialization.'); return _instance; @@ -120,7 +130,7 @@ class Supabase { } _instance._init( url, - publishableKey, + effectiveKey, httpClient: httpClient, customHeaders: headers, realtimeClientOptions: realtimeClientOptions, From 07e5239c58957324feaaf9d19c5f9670235fb40e Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 08:31:00 -0300 Subject: [PATCH 3/6] chore: apply dart format to changed files Co-Authored-By: Claude Sonnet 4.6 --- packages/gotrue/test/client_test.dart | 15 ++++++++++++--- packages/supabase/example/web/main.dart | 16 ++++++---------- packages/supabase_flutter/example/lib/main.dart | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/gotrue/test/client_test.dart b/packages/gotrue/test/client_test.dart index 799741818..582f520c0 100644 --- a/packages/gotrue/test/client_test.dart +++ b/packages/gotrue/test/client_test.dart @@ -40,7 +40,10 @@ void main() { client = GoTrueClient( url: gotrueUrl, - headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, + headers: { + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken + }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -57,7 +60,10 @@ void main() { clientWithAuthConfirmOff = GoTrueClient( url: gotrueUrl, httpClient: NoEmailConfirmationHttpClient(), - headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, + headers: { + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken + }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -541,7 +547,10 @@ void main() { final httpClient = RetryTestHttpClient(); final client = GoTrueClient( url: gotrueUrl, - headers: {'Authorization': 'Bearer $publishableToken', 'apikey': publishableToken}, + headers: { + 'Authorization': 'Bearer $publishableToken', + 'apikey': publishableToken + }, asyncStorage: TestAsyncStorage(), httpClient: httpClient, ); diff --git a/packages/supabase/example/web/main.dart b/packages/supabase/example/web/main.dart index ba5b789f0..c2d5a9680 100644 --- a/packages/supabase/example/web/main.dart +++ b/packages/supabase/example/web/main.dart @@ -16,10 +16,8 @@ void main() { void exampleUsage(SupabaseClient supabase) async { // query data - final data = await supabase - .from('countries') - .select() - .order('name', ascending: true); + final data = + await supabase.from('countries').select().order('name', ascending: true); print(data); // insert data @@ -76,15 +74,13 @@ void exampleUsage(SupabaseClient supabase) async { print('upload response : $storageResponse'); // Get download url - final urlResponse = await supabase.storage - .from('public') - .createSignedUrl('example.txt', 60); + final urlResponse = + await supabase.storage.from('public').createSignedUrl('example.txt', 60); print('download url : $urlResponse'); // Download text file - final fileResponse = await supabase.storage - .from('public') - .download('example.txt'); + final fileResponse = + await supabase.storage.from('public').download('example.txt'); print('downloaded file : ${String.fromCharCodes(fileResponse)}'); // Delete file diff --git a/packages/supabase_flutter/example/lib/main.dart b/packages/supabase_flutter/example/lib/main.dart index bdebb8566..3ff369fe8 100644 --- a/packages/supabase_flutter/example/lib/main.dart +++ b/packages/supabase_flutter/example/lib/main.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { - await Supabase.initialize(url: 'SUPABASE_URL', publishableKey: 'SUPABASE_PUBLISHABLE_KEY'); + await Supabase.initialize( + url: 'SUPABASE_URL', publishableKey: 'SUPABASE_PUBLISHABLE_KEY'); runApp(const MyApp()); } From d7def9be127c71a8d44164d8c04722db91bedd06 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 11:35:22 -0300 Subject: [PATCH 4/6] refactor: rename publishableKey to supabaseKey in public API The key passed to Supabase.initialize() can be either a publishable key (anon) or a secret key depending on the use case, so the parameter name should not imply a specific key type. Aligns with SupabaseClient which already uses supabaseKey as its positional argument. - Rename publishableKey parameter -> supabaseKey in Supabase.initialize() - Update deprecated anonKey message to reference supabaseKey - Update all call sites in tests, examples, docs, and CHANGELOG - Revert internal gotrue test variable names back to anonToken (they represent the anonymous JWT, unrelated to the public API rename) Co-Authored-By: Claude Sonnet 4.6 --- AGENTS.md | 2 +- .../lib/src/functions_client.dart | 2 +- packages/gotrue/test/client_test.dart | 25 ++++++------------- packages/gotrue/test/get_claims_test.dart | 10 ++++---- packages/gotrue/test/provider_test.dart | 6 ++--- .../gotrue/test/src/gotrue_mfa_api_test.dart | 6 ++--- packages/supabase/example/web/main.dart | 2 +- packages/supabase_flutter/CHANGELOG.md | 6 ++--- packages/supabase_flutter/README.md | 2 +- .../supabase_flutter/example/lib/main.dart | 3 +-- .../supabase_flutter/lib/src/supabase.dart | 12 ++++----- packages/supabase_flutter/test/auth_test.dart | 8 +++--- .../supabase_flutter/test/deep_link_test.dart | 2 +- .../test/initialization_test.dart | 20 +++++++-------- .../supabase_flutter/test/lifecycle_test.dart | 2 +- .../test/supabase_flutter_test.dart | 12 ++++----- .../supabase_flutter/test/widget_test.dart | 2 +- 17 files changed, 56 insertions(+), 66 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 765829154..8800809f3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -196,7 +196,7 @@ For integration testing, you may want to point to a local Supabase instance: ```dart await Supabase.initialize( url: 'http://localhost:54321', - publishableKey: 'your-local-publishable-key', + supabaseKey: 'your-local-supabase-key', ); ``` diff --git a/packages/functions_client/lib/src/functions_client.dart b/packages/functions_client/lib/src/functions_client.dart index a5f1e6c2f..ee90cda90 100644 --- a/packages/functions_client/lib/src/functions_client.dart +++ b/packages/functions_client/lib/src/functions_client.dart @@ -83,7 +83,7 @@ class FunctionsClient { /// final fetchClient = FetchClient(mode: RequestMode.cors); /// await Supabase.initialize( /// url: supabaseUrl, - /// publishableKey: supabaseKey, + /// supabaseKey: supabaseKey, /// httpClient: fetchClient, /// ); /// ``` diff --git a/packages/gotrue/test/client_test.dart b/packages/gotrue/test/client_test.dart index 582f520c0..546c9b2ad 100644 --- a/packages/gotrue/test/client_test.dart +++ b/packages/gotrue/test/client_test.dart @@ -17,7 +17,7 @@ void main() { env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; + final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; late String newEmail; late String newPhone; @@ -40,10 +40,7 @@ void main() { client = GoTrueClient( url: gotrueUrl, - headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken - }, + headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -60,10 +57,7 @@ void main() { clientWithAuthConfirmOff = GoTrueClient( url: gotrueUrl, httpClient: NoEmailConfirmationHttpClient(), - headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken - }, + headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, ); @@ -280,7 +274,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': publishableToken}, + headers: {'apikey': anonToken}, ); expect(newClient.currentSession?.refreshToken ?? '', isEmpty); @@ -311,7 +305,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': publishableToken}, + headers: {'apikey': anonToken}, ); expect(newClient.currentSession, isNull); @@ -354,7 +348,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': publishableToken}, + headers: {'apikey': anonToken}, ); // Should fall back to _callRefreshToken and succeed. @@ -405,7 +399,7 @@ void main() { final newClient = GoTrueClient( url: gotrueUrl, - headers: {'apikey': publishableToken}, + headers: {'apikey': anonToken}, ); expect(newClient.currentSession, isNull); @@ -547,10 +541,7 @@ void main() { final httpClient = RetryTestHttpClient(); final client = GoTrueClient( url: gotrueUrl, - headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken - }, + headers: {'Authorization': 'Bearer $anonToken', 'apikey': anonToken}, asyncStorage: TestAsyncStorage(), httpClient: httpClient, ); diff --git a/packages/gotrue/test/get_claims_test.dart b/packages/gotrue/test/get_claims_test.dart index 80cba68e9..6f7244e88 100644 --- a/packages/gotrue/test/get_claims_test.dart +++ b/packages/gotrue/test/get_claims_test.dart @@ -10,7 +10,7 @@ void main() { env.load(); final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; + final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; group('getClaims', () { late GoTrueClient client; @@ -29,8 +29,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken, + 'Authorization': 'Bearer $anonToken', + 'apikey': anonToken, }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, @@ -216,8 +216,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken, + 'Authorization': 'Bearer $anonToken', + 'apikey': anonToken, }, asyncStorage: asyncStorage, flowType: AuthFlowType.implicit, diff --git a/packages/gotrue/test/provider_test.dart b/packages/gotrue/test/provider_test.dart index 877012205..e705388a7 100644 --- a/packages/gotrue/test/provider_test.dart +++ b/packages/gotrue/test/provider_test.dart @@ -11,7 +11,7 @@ void main() { env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; + final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; late GoTrueClient client; late Session session; @@ -20,8 +20,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken, + 'Authorization': 'Bearer $anonToken', + 'apikey': anonToken, }, flowType: AuthFlowType.implicit, ); diff --git a/packages/gotrue/test/src/gotrue_mfa_api_test.dart b/packages/gotrue/test/src/gotrue_mfa_api_test.dart index 424241046..a7295ad8e 100644 --- a/packages/gotrue/test/src/gotrue_mfa_api_test.dart +++ b/packages/gotrue/test/src/gotrue_mfa_api_test.dart @@ -14,7 +14,7 @@ void main() { final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; - final publishableToken = env['GOTRUE_TOKEN'] ?? 'publishableKey'; + final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; late GoTrueClient client; setUp(() async { @@ -26,8 +26,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer $publishableToken', - 'apikey': publishableToken, + 'Authorization': 'Bearer $anonToken', + 'apikey': anonToken, 'x-forwarded-for': '127.0.0.1' }, ); diff --git a/packages/supabase/example/web/main.dart b/packages/supabase/example/web/main.dart index c2d5a9680..fd4edc2e1 100644 --- a/packages/supabase/example/web/main.dart +++ b/packages/supabase/example/web/main.dart @@ -5,7 +5,7 @@ import 'package:web/web.dart' as web; void main() { const supabaseUrl = 'YOUR_SUPABASE_URL'; - const supabaseKey = 'YOUR_PUBLISHABLE_KEY'; + const supabaseKey = 'YOUR_SUPABASE_KEY'; final supabase = SupabaseClient(supabaseUrl, supabaseKey); final element = web.document.querySelector('#output') as web.HTMLDivElement; diff --git a/packages/supabase_flutter/CHANGELOG.md b/packages/supabase_flutter/CHANGELOG.md index b32bd267f..59ad2af50 100644 --- a/packages/supabase_flutter/CHANGELOG.md +++ b/packages/supabase_flutter/CHANGELOG.md @@ -335,7 +335,7 @@ // Initialize Supabase with AuthFlowType.pkce to enable PKCE flow for deep link related auth await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, authFlowType: AuthFlowType.pkce, ); ``` @@ -703,7 +703,7 @@ await Supabase.initialize( url: 'SUPABASE_URL', - publishableKey: 'SUPABASE_PUBLISHABLE_KEY', + supabaseKey: 'SUPABASE_KEY', ); ... @@ -719,7 +719,7 @@ class AuthState extends SupabaseAuthState { // Deep links will also be automatically handled when you initialize Supabase. await Supabase.initialize( url: 'SUPABASE_URL', - publishableKey: 'SUPABASE_PUBLISHABLE_KEY', + supabaseKey: 'SUPABASE_KEY', ); ... diff --git a/packages/supabase_flutter/README.md b/packages/supabase_flutter/README.md index 8e25305e0..a4dc02c54 100644 --- a/packages/supabase_flutter/README.md +++ b/packages/supabase_flutter/README.md @@ -27,7 +27,7 @@ void main() async { await Supabase.initialize( url: SUPABASE_URL, - publishableKey: SUPABASE_PUBLISHABLE_KEY, + supabaseKey: SUPABASE_KEY, ); runApp(MyApp()); diff --git a/packages/supabase_flutter/example/lib/main.dart b/packages/supabase_flutter/example/lib/main.dart index 3ff369fe8..39fc616d9 100644 --- a/packages/supabase_flutter/example/lib/main.dart +++ b/packages/supabase_flutter/example/lib/main.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { - await Supabase.initialize( - url: 'SUPABASE_URL', publishableKey: 'SUPABASE_PUBLISHABLE_KEY'); + await Supabase.initialize(url: 'SUPABASE_URL', supabaseKey: 'SUPABASE_KEY'); runApp(const MyApp()); } diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index 0a97cbece..d2ad9335d 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -52,7 +52,7 @@ class Supabase { /// This must be called only once. If called more than once, an /// [AssertionError] is thrown /// - /// [url] and [publishableKey] can be found on your Supabase dashboard. + /// [url] and [supabaseKey] can be found on your Supabase dashboard. /// /// You can access none public schema by passing different [schema]. /// @@ -76,9 +76,9 @@ class Supabase { /// If [debug] is set to `true`, debug logs will be printed in debug console. Default is `kDebugMode`. static Future initialize({ required String url, - String? publishableKey, + String? supabaseKey, @Deprecated( - 'Use publishableKey instead. anonKey will be removed in a future major version.', + 'Use supabaseKey instead. anonKey will be removed in a future major version.', ) String? anonKey, Map? headers, @@ -91,10 +91,10 @@ class Supabase { bool? debug, }) async { assert( - publishableKey != null || anonKey != null, - 'Either publishableKey or anonKey must be provided.', + supabaseKey != null || anonKey != null, + 'Either supabaseKey or anonKey must be provided.', ); - final effectiveKey = publishableKey ?? anonKey!; + final effectiveKey = supabaseKey ?? anonKey!; if (_instance._isInitialized) { _log.info('Supabase is already initialized. Skipping reinitialization.'); diff --git a/packages/supabase_flutter/test/auth_test.dart b/packages/supabase_flutter/test/auth_test.dart index 8fd422900..42678c2d2 100644 --- a/packages/supabase_flutter/test/auth_test.dart +++ b/packages/supabase_flutter/test/auth_test.dart @@ -46,7 +46,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: mockStorage, @@ -67,7 +67,7 @@ void main() { () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -94,7 +94,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: corruptedStorage, @@ -112,7 +112,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: emptyStorage, diff --git a/packages/supabase_flutter/test/deep_link_test.dart b/packages/supabase_flutter/test/deep_link_test.dart index 666b55d38..ad100dbc1 100644 --- a/packages/supabase_flutter/test/deep_link_test.dart +++ b/packages/supabase_flutter/test/deep_link_test.dart @@ -22,7 +22,7 @@ void main() { ); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, httpClient: pkceHttpClient, authOptions: FlutterAuthClientOptions( diff --git a/packages/supabase_flutter/test/initialization_test.dart b/packages/supabase_flutter/test/initialization_test.dart index 1cf9b14fb..074627087 100644 --- a/packages/supabase_flutter/test/initialization_test.dart +++ b/packages/supabase_flutter/test/initialization_test.dart @@ -28,7 +28,7 @@ void main() { test('initialize successfully with default options', () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -41,7 +41,7 @@ void main() { final localStorage = MockLocalStorage(); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: localStorage, ), @@ -54,7 +54,7 @@ void main() { test('handles initialization with expired session in storage', () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -71,7 +71,7 @@ void main() { test('initialize successfully with PKCE auth flow', () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, authOptions: const FlutterAuthClientOptions( authFlowType: AuthFlowType.pkce, ), @@ -87,7 +87,7 @@ void main() { final httpClient = PkceHttpClient(); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, httpClient: httpClient, ); @@ -98,7 +98,7 @@ void main() { test('initialize successfully with custom access token', () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, accessToken: () async => 'custom-access-token', ); @@ -118,7 +118,7 @@ void main() { // First initialization await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -132,7 +132,7 @@ void main() { // Re-initialize should work without errors await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -141,7 +141,7 @@ void main() { test('handles multiple initializations correctly', () async { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -157,7 +157,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/lifecycle_test.dart b/packages/supabase_flutter/test/lifecycle_test.dart index d94cb3c44..d24805335 100644 --- a/packages/supabase_flutter/test/lifecycle_test.dart +++ b/packages/supabase_flutter/test/lifecycle_test.dart @@ -81,7 +81,7 @@ void main() { readyCompleters = []; await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/supabase_flutter_test.dart b/packages/supabase_flutter/test/supabase_flutter_test.dart index 74ae10df8..694cfdae9 100644 --- a/packages/supabase_flutter/test/supabase_flutter_test.dart +++ b/packages/supabase_flutter/test/supabase_flutter_test.dart @@ -14,7 +14,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -34,7 +34,7 @@ void main() { await Supabase.instance.dispose(); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -50,7 +50,7 @@ void main() { test('with custom access token', () async { final supabase = await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseUrl, + supabaseKey: supabaseUrl, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -73,7 +73,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -97,7 +97,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -123,7 +123,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: localStorage, diff --git a/packages/supabase_flutter/test/widget_test.dart b/packages/supabase_flutter/test/widget_test.dart index 5160d7ff3..463daa858 100644 --- a/packages/supabase_flutter/test/widget_test.dart +++ b/packages/supabase_flutter/test/widget_test.dart @@ -17,7 +17,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - publishableKey: supabaseKey, + supabaseKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), pkceAsyncStorage: MockAsyncStorage(), From cf11877e80194f4d14e7580cd9b901a627187361 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 11:38:46 -0300 Subject: [PATCH 5/6] fix: rename _init param supabasePublishableKey to supabaseKey, use SUPABASE_PUBLISHABLE_KEY in example Co-Authored-By: Claude Sonnet 4.6 --- packages/supabase_flutter/example/lib/main.dart | 3 ++- packages/supabase_flutter/lib/src/supabase.dart | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/supabase_flutter/example/lib/main.dart b/packages/supabase_flutter/example/lib/main.dart index 39fc616d9..cc8ba12c0 100644 --- a/packages/supabase_flutter/example/lib/main.dart +++ b/packages/supabase_flutter/example/lib/main.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { - await Supabase.initialize(url: 'SUPABASE_URL', supabaseKey: 'SUPABASE_KEY'); + await Supabase.initialize( + url: 'SUPABASE_URL', supabaseKey: 'SUPABASE_PUBLISHABLE_KEY'); runApp(const MyApp()); } diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index d2ad9335d..d1eaaf658 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -203,7 +203,7 @@ class Supabase { void _init( String supabaseUrl, - String supabasePublishableKey, { + String supabaseKey, { Client? httpClient, Map? customHeaders, required RealtimeClientOptions realtimeClientOptions, @@ -218,7 +218,7 @@ class Supabase { }; client = SupabaseClient( supabaseUrl, - supabasePublishableKey, + supabaseKey, httpClient: httpClient, headers: headers, realtimeClientOptions: realtimeClientOptions, From 3eb904e79122bbe224bfd5cf093f1b61b50a5a00 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 27 Apr 2026 15:41:13 -0300 Subject: [PATCH 6/6] refactor: publishableKey for flutter package, supabaseKey for dart package; revert CHANGELOG edits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Supabase.initialize() (supabase_flutter): rename supabaseKey → publishableKey. Flutter apps are client-side and should always use the publishable (anon) key, matching the label shown on the Supabase dashboard. - SupabaseClient (supabase): keep supabaseKey as-is. The dart package is used in both client and server contexts, so the generic name is appropriate. - Add a note to SupabaseClient doc distinguishing publishable vs secret usage. - Revert all CHANGELOG modifications — historical entries should not be refactored. Co-Authored-By: Claude Sonnet 4.6 --- AGENTS.md | 2 +- .../lib/src/functions_client.dart | 2 +- packages/supabase/CHANGELOG.md | 2 +- .../supabase/lib/src/supabase_client.dart | 2 ++ packages/supabase_flutter/CHANGELOG.md | 8 ++++---- packages/supabase_flutter/README.md | 2 +- .../supabase_flutter/example/lib/main.dart | 2 +- .../supabase_flutter/lib/src/supabase.dart | 14 +++++++------ packages/supabase_flutter/test/auth_test.dart | 8 ++++---- .../supabase_flutter/test/deep_link_test.dart | 2 +- .../test/initialization_test.dart | 20 +++++++++---------- .../supabase_flutter/test/lifecycle_test.dart | 2 +- .../test/supabase_flutter_test.dart | 12 +++++------ .../supabase_flutter/test/widget_test.dart | 2 +- 14 files changed, 42 insertions(+), 38 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8800809f3..1c6a3aaec 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -196,7 +196,7 @@ For integration testing, you may want to point to a local Supabase instance: ```dart await Supabase.initialize( url: 'http://localhost:54321', - supabaseKey: 'your-local-supabase-key', + publishableKey: 'your-local-supabase-key', ); ``` diff --git a/packages/functions_client/lib/src/functions_client.dart b/packages/functions_client/lib/src/functions_client.dart index ee90cda90..a5f1e6c2f 100644 --- a/packages/functions_client/lib/src/functions_client.dart +++ b/packages/functions_client/lib/src/functions_client.dart @@ -83,7 +83,7 @@ class FunctionsClient { /// final fetchClient = FetchClient(mode: RequestMode.cors); /// await Supabase.initialize( /// url: supabaseUrl, - /// supabaseKey: supabaseKey, + /// publishableKey: supabaseKey, /// httpClient: fetchClient, /// ); /// ``` diff --git a/packages/supabase/CHANGELOG.md b/packages/supabase/CHANGELOG.md index 958c4551d..53340ab53 100644 --- a/packages/supabase/CHANGELOG.md +++ b/packages/supabase/CHANGELOG.md @@ -410,7 +410,7 @@ ```dart // The following will initialize a supabase client that will retry failed uploads up to 25 times, // which is about 10 minutes of retrying. - final supabase = SupabaseClient('Supabase_URL', 'Publishable_key', storageRetryAttempts: 25); + final supabase = SupabaseClient('Supabase_URL', 'Anon_key', storageRetryAttempts: 25); ``` - feat: update storage to v1.1.0 - feat: update gotrue to v1.2.0 diff --git a/packages/supabase/lib/src/supabase_client.dart b/packages/supabase/lib/src/supabase_client.dart index 8a30b1206..5796c940a 100644 --- a/packages/supabase/lib/src/supabase_client.dart +++ b/packages/supabase/lib/src/supabase_client.dart @@ -14,6 +14,8 @@ import 'counter.dart'; /// Creates a Supabase client to interact with your Supabase instance. /// /// [supabaseUrl] and [supabaseKey] can be found on your Supabase dashboard. +/// Pass the `publishable` (anon) key for client-side usage or the `secret` +/// key for trusted server-side environments. /// /// You can access none public schema by passing different [schema]. /// diff --git a/packages/supabase_flutter/CHANGELOG.md b/packages/supabase_flutter/CHANGELOG.md index 59ad2af50..87711f677 100644 --- a/packages/supabase_flutter/CHANGELOG.md +++ b/packages/supabase_flutter/CHANGELOG.md @@ -335,7 +335,7 @@ // Initialize Supabase with AuthFlowType.pkce to enable PKCE flow for deep link related auth await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + anonKey: supabaseKey, authFlowType: AuthFlowType.pkce, ); ``` @@ -478,7 +478,7 @@ // which is about 10 minutes of retrying. await Supabase.initialize( supabaseUrl, - supabasePublishableKey, + supabaseAnonKey, storageRetryAttempts: 25, ); ``` @@ -703,7 +703,7 @@ await Supabase.initialize( url: 'SUPABASE_URL', - supabaseKey: 'SUPABASE_KEY', + anonKey: 'SUPABASE_ANON_KEY', ); ... @@ -719,7 +719,7 @@ class AuthState extends SupabaseAuthState { // Deep links will also be automatically handled when you initialize Supabase. await Supabase.initialize( url: 'SUPABASE_URL', - supabaseKey: 'SUPABASE_KEY', + anonKey: 'SUPABASE_ANON_KEY', ); ... diff --git a/packages/supabase_flutter/README.md b/packages/supabase_flutter/README.md index a4dc02c54..cc948dabd 100644 --- a/packages/supabase_flutter/README.md +++ b/packages/supabase_flutter/README.md @@ -27,7 +27,7 @@ void main() async { await Supabase.initialize( url: SUPABASE_URL, - supabaseKey: SUPABASE_KEY, + publishableKey: SUPABASE_KEY, ); runApp(MyApp()); diff --git a/packages/supabase_flutter/example/lib/main.dart b/packages/supabase_flutter/example/lib/main.dart index cc8ba12c0..3ff369fe8 100644 --- a/packages/supabase_flutter/example/lib/main.dart +++ b/packages/supabase_flutter/example/lib/main.dart @@ -3,7 +3,7 @@ import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { await Supabase.initialize( - url: 'SUPABASE_URL', supabaseKey: 'SUPABASE_PUBLISHABLE_KEY'); + url: 'SUPABASE_URL', publishableKey: 'SUPABASE_PUBLISHABLE_KEY'); runApp(const MyApp()); } diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index d1eaaf658..c2ce4e3c3 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -52,7 +52,9 @@ class Supabase { /// This must be called only once. If called more than once, an /// [AssertionError] is thrown /// - /// [url] and [supabaseKey] can be found on your Supabase dashboard. + /// [url] and [publishableKey] can be found on your Supabase dashboard. + /// Use the `publishable` (anon) key here — never the secret key in a + /// Flutter app. /// /// You can access none public schema by passing different [schema]. /// @@ -76,9 +78,9 @@ class Supabase { /// If [debug] is set to `true`, debug logs will be printed in debug console. Default is `kDebugMode`. static Future initialize({ required String url, - String? supabaseKey, + String? publishableKey, @Deprecated( - 'Use supabaseKey instead. anonKey will be removed in a future major version.', + 'Use publishableKey instead. anonKey will be removed in a future major version.', ) String? anonKey, Map? headers, @@ -91,10 +93,10 @@ class Supabase { bool? debug, }) async { assert( - supabaseKey != null || anonKey != null, - 'Either supabaseKey or anonKey must be provided.', + publishableKey != null || anonKey != null, + 'Either publishableKey or anonKey must be provided.', ); - final effectiveKey = supabaseKey ?? anonKey!; + final effectiveKey = publishableKey ?? anonKey!; if (_instance._isInitialized) { _log.info('Supabase is already initialized. Skipping reinitialization.'); diff --git a/packages/supabase_flutter/test/auth_test.dart b/packages/supabase_flutter/test/auth_test.dart index 42678c2d2..8fd422900 100644 --- a/packages/supabase_flutter/test/auth_test.dart +++ b/packages/supabase_flutter/test/auth_test.dart @@ -46,7 +46,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: mockStorage, @@ -67,7 +67,7 @@ void main() { () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -94,7 +94,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: corruptedStorage, @@ -112,7 +112,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: emptyStorage, diff --git a/packages/supabase_flutter/test/deep_link_test.dart b/packages/supabase_flutter/test/deep_link_test.dart index ad100dbc1..666b55d38 100644 --- a/packages/supabase_flutter/test/deep_link_test.dart +++ b/packages/supabase_flutter/test/deep_link_test.dart @@ -22,7 +22,7 @@ void main() { ); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, httpClient: pkceHttpClient, authOptions: FlutterAuthClientOptions( diff --git a/packages/supabase_flutter/test/initialization_test.dart b/packages/supabase_flutter/test/initialization_test.dart index 074627087..1cf9b14fb 100644 --- a/packages/supabase_flutter/test/initialization_test.dart +++ b/packages/supabase_flutter/test/initialization_test.dart @@ -28,7 +28,7 @@ void main() { test('initialize successfully with default options', () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -41,7 +41,7 @@ void main() { final localStorage = MockLocalStorage(); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: localStorage, ), @@ -54,7 +54,7 @@ void main() { test('handles initialization with expired session in storage', () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -71,7 +71,7 @@ void main() { test('initialize successfully with PKCE auth flow', () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, authOptions: const FlutterAuthClientOptions( authFlowType: AuthFlowType.pkce, ), @@ -87,7 +87,7 @@ void main() { final httpClient = PkceHttpClient(); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, httpClient: httpClient, ); @@ -98,7 +98,7 @@ void main() { test('initialize successfully with custom access token', () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, accessToken: () async => 'custom-access-token', ); @@ -118,7 +118,7 @@ void main() { // First initialization await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -132,7 +132,7 @@ void main() { // Re-initialize should work without errors await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, ); expect(Supabase.instance, isNotNull); @@ -141,7 +141,7 @@ void main() { test('handles multiple initializations correctly', () async { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -157,7 +157,7 @@ void main() { await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: true, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/lifecycle_test.dart b/packages/supabase_flutter/test/lifecycle_test.dart index d24805335..d94cb3c44 100644 --- a/packages/supabase_flutter/test/lifecycle_test.dart +++ b/packages/supabase_flutter/test/lifecycle_test.dart @@ -81,7 +81,7 @@ void main() { readyCompleters = []; await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), diff --git a/packages/supabase_flutter/test/supabase_flutter_test.dart b/packages/supabase_flutter/test/supabase_flutter_test.dart index 694cfdae9..74ae10df8 100644 --- a/packages/supabase_flutter/test/supabase_flutter_test.dart +++ b/packages/supabase_flutter/test/supabase_flutter_test.dart @@ -14,7 +14,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -34,7 +34,7 @@ void main() { await Supabase.instance.dispose(); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -50,7 +50,7 @@ void main() { test('with custom access token', () async { final supabase = await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseUrl, + publishableKey: supabaseUrl, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), @@ -73,7 +73,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockExpiredStorage(), @@ -97,7 +97,7 @@ void main() { mockAppLink(); await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: MockEmptyLocalStorage(), @@ -123,7 +123,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, debug: false, authOptions: FlutterAuthClientOptions( localStorage: localStorage, diff --git a/packages/supabase_flutter/test/widget_test.dart b/packages/supabase_flutter/test/widget_test.dart index 463daa858..5160d7ff3 100644 --- a/packages/supabase_flutter/test/widget_test.dart +++ b/packages/supabase_flutter/test/widget_test.dart @@ -17,7 +17,7 @@ void main() { // Initialize the Supabase singleton await Supabase.initialize( url: supabaseUrl, - supabaseKey: supabaseKey, + publishableKey: supabaseKey, authOptions: FlutterAuthClientOptions( localStorage: MockLocalStorage(), pkceAsyncStorage: MockAsyncStorage(),