From 93ba2a312ce2f389213ecbf375b6d1f52f003eb8 Mon Sep 17 00:00:00 2001 From: Stojan Dimitrovski Date: Mon, 18 Aug 2025 13:47:48 +0200 Subject: [PATCH] docs: indicate publishable key instead of anon in many examples (#37411) * docs: indicate publishable key instead of anon in many examples * replace your-anon-key to string indicating publishable or anon * fix your_... * apply suggestion from @ChrisChinchilla Co-authored-by: Chris Chinchilla * Update keys in code examples * Prettier fix * Update apps/docs/content/guides/functions/schedule-functions.mdx --------- Co-authored-by: Chris Chinchilla --- .../content/_partials/oauth_pkce_flow.mdx | 30 +++--- .../ai/examples/nextjs-vector-search.mdx | 6 +- .../api/automatic-retries-in-supabase-js.mdx | 14 ++- .../content/guides/api/creating-routes.mdx | 8 +- .../guides/api/rest/generating-types.mdx | 5 +- .../guides/api/using-custom-schemas.mdx | 12 ++- .../content/guides/auth/auth-anonymous.mdx | 6 +- .../guides/auth/auth-email-templates.mdx | 5 +- .../auth/auth-helpers/flutter-auth-ui.mdx | 2 +- .../guides/auth/auth-helpers/nextjs-pages.mdx | 2 +- .../guides/auth/auth-helpers/nextjs.mdx | 10 +- .../guides/auth/auth-helpers/remix.mdx | 76 +++++++------ .../guides/auth/auth-helpers/sveltekit.mdx | 78 ++++++++------ apps/docs/content/guides/auth/auth-mfa.mdx | 5 +- .../auth/enterprise-sso/auth-sso-saml.mdx | 4 +- apps/docs/content/guides/auth/jwts.mdx | 18 ++-- apps/docs/content/guides/auth/passwords.mdx | 62 ++++++----- .../guides/auth/quickstarts/nextjs.mdx | 2 +- .../guides/auth/quickstarts/react-native.mdx | 2 +- .../content/guides/auth/quickstarts/react.mdx | 2 +- .../auth/server-side/creating-a-client.mdx | 100 ++++++++++-------- .../guides/auth/server-side/nextjs.mdx | 22 ++-- .../guides/auth/server-side/sveltekit.mdx | 14 +-- apps/docs/content/guides/auth/sessions.mdx | 2 +- .../guides/auth/sessions/pkce-flow.mdx | 2 +- apps/docs/content/guides/auth/signout.mdx | 10 +- .../guides/auth/social-login/auth-apple.mdx | 2 +- .../guides/auth/social-login/auth-azure.mdx | 6 +- .../auth/social-login/auth-bitbucket.mdx | 10 +- .../guides/auth/social-login/auth-discord.mdx | 10 +- .../auth/social-login/auth-facebook.mdx | 4 +- .../guides/auth/social-login/auth-figma.mdx | 4 +- .../guides/auth/social-login/auth-github.mdx | 10 +- .../guides/auth/social-login/auth-gitlab.mdx | 10 +- .../guides/auth/social-login/auth-google.mdx | 2 +- .../guides/auth/social-login/auth-kakao.mdx | 2 +- .../auth/social-login/auth-keycloak.mdx | 4 +- .../auth/social-login/auth-linkedin.mdx | 4 +- .../guides/auth/social-login/auth-notion.mdx | 4 +- .../guides/auth/social-login/auth-slack.mdx | 4 +- .../guides/auth/social-login/auth-spotify.mdx | 4 +- .../guides/auth/social-login/auth-twitch.mdx | 4 +- .../guides/auth/social-login/auth-twitter.mdx | 10 +- .../guides/auth/social-login/auth-workos.mdx | 2 +- .../guides/auth/social-login/auth-zoom.mdx | 4 +- .../content/guides/auth/third-party/auth0.mdx | 26 +++-- .../guides/auth/third-party/aws-cognito.mdx | 24 +++-- .../content/guides/auth/third-party/clerk.mdx | 2 +- .../guides/auth/third-party/firebase-auth.mdx | 20 ++-- .../guides/auth/third-party/workos.mdx | 14 ++- apps/docs/content/guides/functions/auth.mdx | 2 +- .../guides/functions/connect-to-postgres.mdx | 2 +- apps/docs/content/guides/functions/deploy.mdx | 4 +- .../content/guides/functions/quickstart.mdx | 8 +- .../guides/functions/schedule-functions.mdx | 2 +- .../docs/content/guides/functions/secrets.mdx | 4 +- .../content/guides/functions/unit-test.mdx | 6 +- .../getting-started/quickstarts/flutter.mdx | 2 +- .../quickstarts/ios-swiftui.mdx | 2 +- .../getting-started/quickstarts/nextjs.mdx | 4 +- .../getting-started/quickstarts/nuxtjs.mdx | 4 +- .../getting-started/quickstarts/reactjs.mdx | 4 +- .../getting-started/quickstarts/solidjs.mdx | 4 +- .../getting-started/quickstarts/sveltekit.mdx | 12 +-- .../getting-started/quickstarts/vue.mdx | 4 +- .../tutorials/with-expo-react-native.mdx | 4 +- .../tutorials/with-flutter.mdx | 4 +- .../tutorials/with-ionic-react.mdx | 4 +- .../tutorials/with-ionic-vue.mdx | 4 +- .../getting-started/tutorials/with-kotlin.mdx | 8 +- .../getting-started/tutorials/with-nextjs.mdx | 8 +- .../getting-started/tutorials/with-nuxt-3.mdx | 2 +- .../getting-started/tutorials/with-react.mdx | 4 +- .../tutorials/with-redwoodjs.mdx | 2 +- .../getting-started/tutorials/with-refine.mdx | 4 +- .../tutorials/with-solidjs.mdx | 4 +- .../getting-started/tutorials/with-svelte.mdx | 2 +- .../tutorials/with-sveltekit.mdx | 2 +- .../getting-started/tutorials/with-swift.mdx | 2 +- .../getting-started/tutorials/with-vue-3.mdx | 4 +- .../integrations/vercel-marketplace.mdx | 4 +- .../local-development/testing/overview.mdx | 2 +- .../guides/platform/custom-domains.mdx | 4 +- .../content/guides/realtime/broadcast.mdx | 12 +-- .../docs/content/guides/realtime/concepts.mdx | 8 +- .../guides/realtime/postgres-changes.mdx | 2 +- .../docs/content/guides/realtime/presence.mdx | 12 +-- apps/docs/content/guides/telemetry/logs.mdx | 2 +- ...ase-auth-helpers-to-ssr-package-5NRunM.mdx | 6 +- apps/docs/spec/supabase_dart_v1.yml | 4 +- apps/docs/spec/supabase_dart_v2.yml | 4 +- apps/docs/spec/supabase_js_v1.yml | 12 +-- apps/docs/spec/supabase_js_v2.yml | 14 +-- apps/docs/spec/supabase_kt_v1.yml | 16 +-- apps/docs/spec/supabase_kt_v2.yml | 16 +-- apps/docs/spec/supabase_kt_v3.yml | 16 +-- apps/docs/spec/supabase_swift_v1.yml | 8 +- apps/docs/spec/supabase_swift_v2.yml | 12 +-- .../hono/src/middleware/auth.middleware.ts | 6 +- examples/auth/nextjs/.env.example | 2 +- examples/auth/nextjs/README.md | 4 +- examples/auth/nextjs/utils/supabase/client.ts | 2 +- .../auth/nextjs/utils/supabase/middleware.ts | 2 +- examples/auth/nextjs/utils/supabase/server.ts | 2 +- .../.env.local.example | 2 +- .../utils/supabase.ts | 2 +- .../.env.local.example | 2 +- .../utils/supabase-browser.ts | 2 +- .../utils/supabase-server.ts | 2 +- examples/clerk/hooks/useSupabaseClient.ts | 2 +- examples/prompts/nextjs-supabase-auth.md | 6 +- .../README.md | 2 +- .../lib/main.dart | 2 +- .../realtime/nextjs-auth-presence/README.md | 2 +- .../nextjs-auth-presence/sample.env.local | 2 +- .../nextjs-authorization-demo/.env.example | 2 +- .../utils/supabase/client.ts | 2 +- .../utils/supabase/middleware.ts | 2 +- .../utils/supabase/server.ts | 2 +- .../nextjs-slack-clone-dotenvx/README.md | 2 +- .../nextjs-slack-clone-dotenvx/lib/Store.js | 2 +- .../nextjs-slack-clone-dotenvx/supabase/.env | 2 +- .../supabase/.env.preview | 2 +- .../supabase/.env.production | 2 +- .../nextjs-slack-clone/.env.example | 2 +- .../.env.production.example | 2 +- .../slack-clone/nextjs-slack-clone/README.md | 2 +- .../nextjs-slack-clone/lib/Store.js | 2 +- .../storage/resumable-upload-uppy/index.html | 2 +- .../todo-list/nextjs-todo-list/.env.example | 2 +- .../nextjs-todo-list/.env.production.example | 2 +- examples/todo-list/nextjs-todo-list/README.md | 2 +- .../nextjs-todo-list/lib/initSupabase.ts | 2 +- .../todo-list/sveltejs-todo-list/.env.example | 2 +- .../expo-push-notifications/lib/supabase.ts | 4 +- .../expo-user-management/.env.example | 2 +- .../expo-user-management/lib/supabase.ts | 4 +- .../nextjs-user-management/.env.example | 2 +- .../.env.production.example | 2 +- .../nextjs-user-management/README.md | 2 +- .../utils/supabase/client.ts | 2 +- .../utils/supabase/middleware.ts | 2 +- .../utils/supabase/server.ts | 2 +- .../src/supabaseClient.js | 4 +- .../src/utility/supabaseClient.ts | 4 +- .../solid-user-management/.env.example | 2 +- .../src/supabaseClient.tsx | 4 +- .../svelte-user-management/.env.example | 2 +- .../src/supabaseClient.ts | 4 +- .../sveltekit-user-management/.env.example | 2 +- .../src/hooks.server.ts | 4 +- .../src/routes/+layout.ts | 6 +- .../vue3-user-management/.env.example | 2 +- .../vue3-user-management/src/supabase.js | 4 +- 154 files changed, 612 insertions(+), 491 deletions(-) diff --git a/apps/docs/content/_partials/oauth_pkce_flow.mdx b/apps/docs/content/_partials/oauth_pkce_flow.mdx index c98eacb6336..f1035c08937 100644 --- a/apps/docs/content/_partials/oauth_pkce_flow.mdx +++ b/apps/docs/content/_partials/oauth_pkce_flow.mdx @@ -150,7 +150,7 @@ export const GET: APIRoute = async ({ request, cookies, redirect }) => { if (code) { const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -194,18 +194,22 @@ export async function loader({ request }: LoaderFunctionArgs) { const headers = new Headers() if (code) { - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - cookies: { - getAll() { - return parseCookieHeader(request.headers.get('Cookie') ?? '') + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + cookies: { + getAll() { + return parseCookieHeader(request.headers.get('Cookie') ?? '') + }, + setAll(cookiesToSet) { + cookiesToSet.forEach(({ name, value, options }) => + headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) + ) + }, }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) - }, - }, - }) + } + ) const { error } = await supabase.auth.exchangeCodeForSession(code) @@ -233,7 +237,7 @@ app.get("/auth/callback", async function (req, res) { if (code) { const supabase = createServerClient( process.env.SUPABASE_URL, - process.env.SUPABASE_ANON_KEY, { + process.env.SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { return parseCookieHeader(context.req.headers.cookie ?? '') diff --git a/apps/docs/content/guides/ai/examples/nextjs-vector-search.mdx b/apps/docs/content/guides/ai/examples/nextjs-vector-search.mdx index 47d201dccf4..dc0d3b8fc74 100644 --- a/apps/docs/content/guides/ai/examples/nextjs-vector-search.mdx +++ b/apps/docs/content/guides/ai/examples/nextjs-vector-search.mdx @@ -283,7 +283,7 @@ With our database set up, we need to process and store all `.mdx` files in the ` ```bash NEXT_PUBLIC_SUPABASE_URL= - NEXT_PUBLIC_SUPABASE_ANON_KEY= + NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= SUPABASE_SERVICE_ROLE_KEY= # Get your key at https://platform.openai.com/account/api-keys @@ -470,8 +470,8 @@ const handleConfirm = React.useCallback( const eventSource = new SSE(`api/vector-search`, { headers: { - apikey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? '', - Authorization: `Bearer ${process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}`, + apikey: process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ?? '', + Authorization: `Bearer ${process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY}`, 'Content-Type': 'application/json', }, payload: JSON.stringify({ query }), diff --git a/apps/docs/content/guides/api/automatic-retries-in-supabase-js.mdx b/apps/docs/content/guides/api/automatic-retries-in-supabase-js.mdx index e9cfbe80eaf..094f4b25a40 100644 --- a/apps/docs/content/guides/api/automatic-retries-in-supabase-js.mdx +++ b/apps/docs/content/guides/api/automatic-retries-in-supabase-js.mdx @@ -32,11 +32,15 @@ import fetchRetry from 'fetch-retry' const fetchWithRetry = fetchRetry(fetch) // Create a Supabase client instance with the custom fetch -const supabase = createClient('https://your-supabase-url.supabase.co', 'your-anon-key', { - global: { - fetch: fetchWithRetry, - }, -}) +const supabase = createClient( + 'https://your-supabase-url.supabase.co', + 'sb_publishable_... or anon key', + { + global: { + fetch: fetchWithRetry, + }, + } +) ``` ## 3. Configure retry options diff --git a/apps/docs/content/guides/api/creating-routes.mdx b/apps/docs/content/guides/api/creating-routes.mdx index 64c44884024..6ef1b30c0df 100644 --- a/apps/docs/content/guides/api/creating-routes.mdx +++ b/apps/docs/content/guides/api/creating-routes.mdx @@ -72,7 +72,7 @@ Both of these routes require the `anon` key to be passed through an `apikey` hea You can interact with your API directly via HTTP requests, or you can use the client libraries which we provide. Let's see how to make a request to the `todos` table which we created in the first step, -using the API URL (`SUPABASE_URL`) and Key (`SUPABASE_ANON_KEY`) we provided: +using the API URL (`SUPABASE_URL`) and Key (`SUPABASE_PUBLISHABLE_KEY`) we provided: /rest/v1/todos' \ --H "apikey: " \ --H "Authorization: Bearer " +-H "apikey: " \ +-H "Authorization: Bearer " ``` diff --git a/apps/docs/content/guides/api/rest/generating-types.mdx b/apps/docs/content/guides/api/rest/generating-types.mdx index 7c5b6d288e9..d74f2ce603b 100644 --- a/apps/docs/content/guides/api/rest/generating-types.mdx +++ b/apps/docs/content/guides/api/rest/generating-types.mdx @@ -95,7 +95,10 @@ You can supply the type definitions to `supabase-js` like so: import { createClient } from '@supabase/supabase-js' import { Database } from './database.types' -const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY) +const supabase = createClient( + process.env.SUPABASE_URL, + process.env.SUPABASE_PUBLISHABLE_KEY +) ``` ## Helper types for tables and joins diff --git a/apps/docs/content/guides/api/using-custom-schemas.mdx b/apps/docs/content/guides/api/using-custom-schemas.mdx index 929fd31123b..5f9fe4770d5 100644 --- a/apps/docs/content/guides/api/using-custom-schemas.mdx +++ b/apps/docs/content/guides/api/using-custom-schemas.mdx @@ -45,7 +45,9 @@ Now you can access these schemas from data APIs: ```js // Initialize the JS client import { createClient } from '@supabase/supabase-js' -const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, { db: { schema: 'myschema' } }) +const supabase = createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, { + db: { schema: 'myschema' }, +}) // Make a request const { data: todos, error } = await supabase.from('todos').select('*') @@ -81,14 +83,14 @@ final data = await supabase.schema('myschema').from('todos').select(); # for GET or HEAD request use Accept-Profile curl '/rest/v1/todos' \ - -H "apikey: " \ - -H "Authorization: Bearer " \ + -H "apikey: " \ + -H "Authorization: Bearer " \ -H "Accept-Profile: myschema" # for POST, PATCH, PUT and DELETE Request use Content-Profile curl -X POST '/rest/v1/todos' \ - -H "apikey: " \ - -H "Authorization: Bearer " \ + -H "apikey: " \ + -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -H "Content-Profile: myschema" \ -d '{"column_name": "value"}' diff --git a/apps/docs/content/guides/auth/auth-anonymous.mdx b/apps/docs/content/guides/auth/auth-anonymous.mdx index 0a4f0b43c2e..30b6af58592 100644 --- a/apps/docs/content/guides/auth/auth-anonymous.mdx +++ b/apps/docs/content/guides/auth/auth-anonymous.mdx @@ -57,7 +57,7 @@ Call the [`signInAnonymously()`](/docs/reference/javascript/auth-signinanonymous ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.signInAnonymously() @@ -121,7 +121,7 @@ You can use the [`updateUser()`](/docs/reference/javascript/auth-updateuser) met ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data: updateEmailData, error: updateEmailError } = await supabase.auth.updateUser({ @@ -205,7 +205,7 @@ You can use the [`linkIdentity()`](/docs/reference/javascript/auth-linkidentity) ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.linkIdentity({ provider: 'google' }) diff --git a/apps/docs/content/guides/auth/auth-email-templates.mdx b/apps/docs/content/guides/auth/auth-email-templates.mdx index bda140dfe59..8f23b52a284 100644 --- a/apps/docs/content/guides/auth/auth-email-templates.mdx +++ b/apps/docs/content/guides/auth/auth-email-templates.mdx @@ -107,7 +107,10 @@ When the user clicks on the link, the request will hit `https://api.example.com/ ```ts import { createClient, type EmailOtpType } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- const { token_hash, type } = Object.fromEntries(new URLSearchParams(window.location.search)) diff --git a/apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx b/apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx index 73507acfc71..c0e25cb4fd0 100644 --- a/apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx @@ -27,7 +27,7 @@ import 'package:supabase_auth_ui/supabase_auth_ui.dart'; void main() async { await Supabase.initialize( url: dotenv.get('SUPABASE_URL'), - anonKey: dotenv.get('SUPABASE_ANON_KEY'), + anonKey: dotenv.get('SUPABASE_PUBLISHABLE_KEY'), ); runApp(const MyApp()); diff --git a/apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx b/apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx index 9af561e396d..7e276930bb8 100644 --- a/apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx @@ -57,7 +57,7 @@ Retrieve your project URL and anon key in your project's [API settings](https:// ```bash .env.local NEXT_PUBLIC_SUPABASE_URL=your-supabase-url -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-supabase-publishable-key ``` ## Basic setup diff --git a/apps/docs/content/guides/auth/auth-helpers/nextjs.mdx b/apps/docs/content/guides/auth/auth-helpers/nextjs.mdx index 547cdfc1ee6..af8e4bf0bd2 100644 --- a/apps/docs/content/guides/auth/auth-helpers/nextjs.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/nextjs.mdx @@ -55,7 +55,7 @@ Retrieve your project's URL and anon key from your [API settings](https://supaba ```bash .env.local NEXT_PUBLIC_SUPABASE_URL=your-supabase-url -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-supabase-publishable-key ``` ## Managing session with middleware @@ -1172,7 +1172,7 @@ import { createClient } from '@supabase/supabase-js' export default async function Page() { const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ) const { data } = await supabase.from('todos').select() @@ -1192,7 +1192,7 @@ import type { Database } from '@/lib/database.types' export default async function Page() { const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) const { data } = await supabase.from('todos').select() @@ -1229,7 +1229,7 @@ export async function POST(request) { const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ) const { data } = await supabase.from('todos').insert({ title }).select() @@ -1252,7 +1252,7 @@ export async function POST(request: Request) { const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) const { data } = await supabase.from('todos').insert({ title }).select() diff --git a/apps/docs/content/guides/auth/auth-helpers/remix.mdx b/apps/docs/content/guides/auth/auth-helpers/remix.mdx index da1299d328a..629d75f67b0 100644 --- a/apps/docs/content/guides/auth/auth-helpers/remix.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/remix.mdx @@ -59,7 +59,7 @@ Retrieve your project URL and anon key in your project's [API settings](https:// ```bash .env SUPABASE_URL=YOUR_SUPABASE_URL -SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` ### Code Exchange route @@ -89,7 +89,7 @@ export const loader = async ({ request }) => { if (code) { const supabaseClient = createServerClient( process.env.SUPABASE_URL, - process.env.SUPABASE_ANON_KEY, + process.env.SUPABASE_PUBLISHABLE_KEY, { request, response } ) await supabaseClient.auth.exchangeCodeForSession(code) @@ -122,7 +122,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { if (code) { const supabaseClient = createServerClient( process.env.SUPABASE_URL!, - process.env.SUPABASE_ANON_KEY!, + process.env.SUPABASE_PUBLISHABLE_KEY!, { request, response } ) await supabaseClient.auth.exchangeCodeForSession(code) @@ -145,7 +145,7 @@ The Supabase client can now be used server-side - in loaders and actions - by ca ### Loader -Loader functions run on the server immediately before the component is rendered. They respond to all GET requests on a route. You can create an authenticated Supabase client by calling the `createServerClient` function and passing it your `SUPABASE_URL`, `SUPABASE_ANON_KEY`, and a `Request` and `Response`. +Loader functions run on the server immediately before the component is rendered. They respond to all GET requests on a route. You can create an authenticated Supabase client by calling the `createServerClient` function and passing it your `SUPABASE_URL`, `SUPABASE_PUBLISHABLE_KEY`, and a `Request` and `Response`. { const supabaseClient = createServerClient( process.env.SUPABASE_URL, - process.env.SUPABASE_ANON_KEY, + process.env.SUPABASE_PUBLISHABLE_KEY, { request, response } ) @@ -203,7 +203,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { const response = new Response() const supabaseClient = createServerClient( process.env.SUPABASE_URL!, - process.env.SUPABASE_ANON_KEY!, + process.env.SUPABASE_PUBLISHABLE_KEY!, { request, response } ) @@ -229,7 +229,7 @@ Supabase will set cookie headers to manage the user's auth session, therefore, t ### Action -Action functions run on the server and respond to HTTP requests to a route, other than GET - POST, PUT, PATCH, DELETE etc. You can create an authenticated Supabase client by calling the `createServerClient` function and passing it your `SUPABASE_URL`, `SUPABASE_ANON_KEY`, and a `Request` and `Response`. +Action functions run on the server and respond to HTTP requests to a route, other than GET - POST, PUT, PATCH, DELETE etc. You can create an authenticated Supabase client by calling the `createServerClient` function and passing it your `SUPABASE_URL`, `SUPABASE_PUBLISHABLE_KEY`, and a `Request` and `Response`. { const supabaseClient = createServerClient( process.env.SUPABASE_URL, - process.env.SUPABASE_ANON_KEY, + process.env.SUPABASE_PUBLISHABLE_KEY, { request, response } ) @@ -284,7 +284,7 @@ export const action = async ({ request }: ActionFunctionArgs) => { const supabaseClient = createServerClient( process.env.SUPABASE_URL!, - process.env.SUPABASE_ANON_KEY!, + process.env.SUPABASE_PUBLISHABLE_KEY!, { request, response } ) @@ -355,7 +355,7 @@ Since our environment variables are not available client-side, we need to plumb export const loader = () => { const env = { SUPABASE_URL: process.env.SUPABASE_URL, - SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY, + SUPABASE_PUBLISHABLE_KEY: process.env.SUPABASE_PUBLISHABLE_KEY, } return json({ env }) @@ -377,7 +377,9 @@ const { env } = useLoaderData() We then want to instantiate a single instance of a Supabase browser client, to be used across our client-side components. ```jsx app/root.jsx -const [supabase] = useState(() => createBrowserClient(env.SUPABASE_URL, env.SUPABASE_ANON_KEY)) +const [supabase] = useState(() => + createBrowserClient(env.SUPABASE_URL, env.SUPABASE_PUBLISHABLE_KEY) +) ``` And then we can share this instance across our application with Outlet Context. @@ -393,7 +395,7 @@ And then we can share this instance across our application with Outlet Context. export const loader = ({}: LoaderFunctionArgs) => { const env = { SUPABASE_URL: process.env.SUPABASE_URL!, - SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY!, + SUPABASE_PUBLISHABLE_KEY: process.env.SUPABASE_PUBLISHABLE_KEY!, } return json({ env }) @@ -416,7 +418,7 @@ We then want to instantiate a single instance of a Supabase browser client, to b ```tsx app/root.tsx const [supabase] = useState(() => - createBrowserClient(env.SUPABASE_URL, env.SUPABASE_ANON_KEY) + createBrowserClient(env.SUPABASE_URL, env.SUPABASE_PUBLISHABLE_KEY) ) ``` @@ -453,15 +455,19 @@ Let's pipe that through from our loader. export const loader = async ({ request }) => { const env = { SUPABASE_URL: process.env.SUPABASE_URL, - SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY, + SUPABASE_PUBLISHABLE_KEY: process.env.SUPABASE_PUBLISHABLE_KEY, } const response = new Response() - const supabase = createServerClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY, { - request, - response, - }) + const supabase = createServerClient( + process.env.SUPABASE_URL, + process.env.SUPABASE_PUBLISHABLE_KEY, + { + request, + response, + } + ) const { data: { session }, @@ -487,15 +493,19 @@ export const loader = async ({ request }) => { export const loader = async ({ request }: LoaderFunctionArgs) => { const env = { SUPABASE_URL: process.env.SUPABASE_URL!, - SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY!, + SUPABASE_PUBLISHABLE_KEY: process.env.SUPABASE_PUBLISHABLE_KEY!, } const response = new Response() - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - request, - response, - }) + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + request, + response, + } + ) const { data: { session }, @@ -533,7 +543,9 @@ And then use the revalidator, inside the `onAuthStateChange` hook. const { env, session } = useLoaderData() const { revalidate } = useRevalidator() -const [supabase] = useState(() => createBrowserClient(env.SUPABASE_URL, env.SUPABASE_ANON_KEY)) +const [supabase] = useState(() => + createBrowserClient(env.SUPABASE_URL, env.SUPABASE_PUBLISHABLE_KEY) +) const serverAccessToken = session?.access_token @@ -562,7 +574,7 @@ const { env, session } = useLoaderData() const { revalidate } = useRevalidator() const [supabase] = useState(() => - createBrowserClient(env.SUPABASE_URL, env.SUPABASE_ANON_KEY) + createBrowserClient(env.SUPABASE_URL, env.SUPABASE_PUBLISHABLE_KEY) ) const serverAccessToken = session?.access_token @@ -703,10 +715,14 @@ import { useEffect, useState } from 'react' export const loader = async ({ request }) => { const response = new Response() - const supabase = createServerClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY, { - request, - response, - }) + const supabase = createServerClient( + process.env.SUPABASE_URL, + process.env.SUPABASE_PUBLISHABLE_KEY, + { + request, + response, + } + ) const { data } = await supabase.from('posts').select() @@ -760,7 +776,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { const response = new Response() const supabase = createServerClient( process.env.SUPABASE_URL!, - process.env.SUPABASE_ANON_KEY!, + process.env.SUPABASE_PUBLISHABLE_KEY!, { request, response, diff --git a/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx b/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx index 25d9724d262..c518caeba91 100644 --- a/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx @@ -45,7 +45,7 @@ Retrieve your project's URL and anon key from your [API settings](https://supaba ```bash .env.local # Find these in your Supabase project settings https://supabase.com/dashboard/project/_/settings/api PUBLIC_SUPABASE_URL=https://your-project.supabase.co -PUBLIC_SUPABASE_ANON_KEY=your-anon-key +PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon key ``` ### Creating a Supabase client @@ -65,13 +65,13 @@ Create a new `hooks.server.js` file in the root of your project and populate wit ```js src/hooks.server.js // src/hooks.server.js -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit' export const handle = async ({ event, resolve }) => { event.locals.supabase = createSupabaseServerClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event, }) @@ -111,14 +111,14 @@ Create a new `hooks.server.ts` file in the root of your project and populate wit ```ts src/hooks.server.ts // src/hooks.server.ts -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit' import type { Handle } from '@sveltejs/kit' export const handle: Handle = async ({ event, resolve }) => { event.locals.supabase = createSupabaseServerClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event, }) @@ -307,7 +307,7 @@ To utilize Supabase in shared load functions and within pages, it is essential t ```ts src/routes/+layout.js // src/routes/+layout.js -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import { createSupabaseLoadClient } from '@supabase/auth-helpers-sveltekit' export const load = async ({ fetch, data, depends }) => { @@ -315,7 +315,7 @@ export const load = async ({ fetch, data, depends }) => { const supabase = createSupabaseLoadClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event: { fetch }, serverSession: data.session, }) @@ -339,7 +339,7 @@ export const load = async ({ fetch, data, depends }) => { ```ts src/routes/+layout.ts // src/routes/+layout.ts -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import { createSupabaseLoadClient } from '@supabase/auth-helpers-sveltekit' import type { Database } from '../DatabaseDefinitions' @@ -348,7 +348,7 @@ export const load = async ({ fetch, data, depends }) => { const supabase = createSupabaseLoadClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event: { fetch }, serverSession: data.session, }) @@ -648,7 +648,7 @@ Edit your `/src/hooks.server.js` with the below: ```js src/hooks.server.js // src/hooks.server.js -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit' import { redirect, error } from '@sveltejs/kit' import { sequence } from '@sveltejs/kit/hooks' @@ -656,7 +656,7 @@ import { sequence } from '@sveltejs/kit/hooks' async function supabase({ event, resolve }) { event.locals.supabase = createSupabaseServerClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event, }) @@ -717,14 +717,14 @@ export const handle = sequence(supabase, authorization) ```ts src/hooks.server.ts // src/hooks.server.ts import { type Handle, redirect, error } from '@sveltejs/kit' -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit' import { sequence } from '@sveltejs/kit/hooks' async function supabase({ event, resolve }) { event.locals.supabase = createSupabaseServerClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event, }) @@ -932,9 +932,12 @@ import { createClient } from '@supabase/auth-helpers-sveltekit' import { env } from '$env/dynamic/public' // or use the static env -// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; -export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY) +export const supabaseClient = createClient( + env.PUBLIC_SUPABASE_URL, + env.PUBLIC_SUPABASE_PUBLISHABLE_KEY +) ``` @@ -942,14 +945,14 @@ export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_S ```js src/hooks.server.ts // src/hooks.server.ts -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit' import type { Handle } from '@sveltejs/kit' export const handle: Handle = async ({ event, resolve }) => { event.locals.supabase = createSupabaseServerClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event, }) @@ -1024,7 +1027,7 @@ In order to use the Supabase library in your client code you will need to setup ```ts src/routes/+layout.ts // src/routes/+layout.ts import { invalidate } from '$app/navigation' -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import { createSupabaseLoadClient } from '@supabase/auth-helpers-sveltekit' import type { LayoutLoad } from './$types' import type { Database } from '../DatabaseDefinitions' @@ -1034,7 +1037,7 @@ export const load: LayoutLoad = async ({ fetch, data, depends }) => { const supabase = createSupabaseLoadClient({ supabaseUrl: PUBLIC_SUPABASE_URL, - supabaseKey: PUBLIC_SUPABASE_ANON_KEY, + supabaseKey: PUBLIC_SUPABASE_PUBLISHABLE_KEY, event: { fetch }, serverSession: data.session, }) @@ -1295,12 +1298,16 @@ import { dev } from '$app/environment' import { env } from '$env/dynamic/public' // or use the static env -// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; -export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, { - persistSession: false, - autoRefreshToken: false, -}) +export const supabaseClient = createClient( + env.PUBLIC_SUPABASE_URL, + env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, + { + persistSession: false, + autoRefreshToken: false, + } +) setupSupabaseHelpers({ supabaseClient, @@ -1318,9 +1325,12 @@ import { createClient } from '@supabase/auth-helpers-sveltekit' import { env } from '$env/dynamic/public' // or use the static env -// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; -export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY) +export const supabaseClient = createClient( + env.PUBLIC_SUPABASE_URL, + env.PUBLIC_SUPABASE_PUBLISHABLE_KEY +) ``` @@ -1646,7 +1656,7 @@ import { createSupabaseClient } from '@supabase/auth-helpers-sveltekit'; const { supabaseClient } = createSupabaseClient( import.meta.env.VITE_SUPABASE_URL as string, - import.meta.env.VITE_SUPABASE_ANON_KEY as string + import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY as string ); export { supabaseClient }; @@ -1662,12 +1672,16 @@ import { dev } from '$app/environment' import { env } from '$env/dynamic/public' // or use the static env -// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; -export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, { - persistSession: false, - autoRefreshToken: false, -}) +export const supabaseClient = createClient( + env.PUBLIC_SUPABASE_URL, + env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, + { + persistSession: false, + autoRefreshToken: false, + } +) setupSupabaseHelpers({ supabaseClient, diff --git a/apps/docs/content/guides/auth/auth-mfa.mdx b/apps/docs/content/guides/auth/auth-mfa.mdx index 9a67c33cc97..719528aa2e2 100644 --- a/apps/docs/content/guides/auth/auth-mfa.mdx +++ b/apps/docs/content/guides/auth/auth-mfa.mdx @@ -82,7 +82,10 @@ When a user unenrolls a factor, call `supabase.auth.mfa.unenroll()` with the ID ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- supabase.auth.mfa.unenroll({ factorId: 'd30fd651-184e-4748-a928-0a4b9be1d429' }) diff --git a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx index 56bae4f8f16..77144658e12 100644 --- a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx +++ b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx @@ -195,7 +195,7 @@ To initiate a sign-in request from your application's user interface (i.e. the S ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- supabase.auth.signInWithSSO({ @@ -436,7 +436,7 @@ Yes, also referred to as [cross-origin authentication within the same site](http ```ts import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.signInWithSSO({ diff --git a/apps/docs/content/guides/auth/jwts.mdx b/apps/docs/content/guides/auth/jwts.mdx index a20b58a6cb1..cc98b5825f2 100644 --- a/apps/docs/content/guides/auth/jwts.mdx +++ b/apps/docs/content/guides/auth/jwts.mdx @@ -93,11 +93,15 @@ If you wish to send a JWT from a Third-Party Auth provider, or one you made your ```typescript import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', 'SUPABASE_ANON_KEY', { - accessToken: async () => { - return '' - }, -}) +const supabase = createClient( + 'https://.supabase.co', + 'SUPABASE_PUBLISHABLE_KEY', + { + accessToken: async () => { + return '' + }, + } +) ``` @@ -124,7 +128,7 @@ import Supabase let supabase = SupabaseClient( supabaseURL: URL(string: "https://.supabase.co")!, - supabaseKey: "SUPABASE_ANON_KEY", + supabaseKey: "SUPABASE_PUBLISHABLE_KEY", options: SupabaseClientOptions( auth: SupabaseClientOptions.AuthOptions( accessToken: { @@ -142,7 +146,7 @@ let supabase = SupabaseClient( ```kotlin val supabase = createSupabaseClient( "https://.supabase.co", - "SUPABASE_ANON_KEY" + "SUPABASE_PUBLISHABLE_KEY" ) { accessToken = { "" diff --git a/apps/docs/content/guides/auth/passwords.mdx b/apps/docs/content/guides/auth/passwords.mdx index 961f4cc4c73..218d675e6da 100644 --- a/apps/docs/content/guides/auth/passwords.mdx +++ b/apps/docs/content/guides/auth/passwords.mdx @@ -57,7 +57,7 @@ If you don't specify a redirect URL, the user is automatically redirected to you ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signUpNewUser() { @@ -266,7 +266,7 @@ export const GET: APIRoute = async ({ request, cookies, redirect }) => { if (token_hash && type) { const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -313,16 +313,20 @@ export async function loader({ request }: LoaderFunctionArgs) { const headers = new Headers() if (token_hash && type) { - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - cookies: { - getAll() { - return parseCookieHeader(request.headers.get('Cookie') ?? '') + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + cookies: { + getAll() { + return parseCookieHeader(request.headers.get('Cookie') ?? '') + }, + setAll(key, value, options) { + headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) + }, }, - setAll(key, value, options) { - headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) - }, - }, - }) + } + ) const { error } = await supabase.auth.verifyOtp({ type, @@ -390,7 +394,7 @@ If you don't specify a redirect URL, the user is automatically redirected to you ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signUpNewUser() { @@ -477,7 +481,7 @@ When your user signs in, call [`signInWithPassword()`](/docs/reference/javascrip ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signInWithEmail() { @@ -570,7 +574,7 @@ Collect the user's email address and request a password reset email. Specify the ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- await supabase.auth.resetPasswordForEmail('valid.email@supabase.io', { @@ -749,7 +753,7 @@ export const GET: APIRoute = async ({ request, cookies, redirect }) => { if (token_hash && type) { const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -796,16 +800,20 @@ export async function loader({ request }: LoaderFunctionArgs) { const headers = new Headers() if (token_hash && type) { - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - cookies: { - getAll() { - return parseCookieHeader(request.headers.get('Cookie') ?? '') + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + cookies: { + getAll() { + return parseCookieHeader(request.headers.get('Cookie') ?? '') + }, + setAll(key, value, options) { + headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) + }, }, - setAll(key, value, options) { - headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) - }, - }, - }) + } + ) const { error } = await supabase.auth.verifyOtp({ type, @@ -1004,7 +1012,7 @@ To sign up the user, call [`signUp()`](/docs/reference/javascript/auth-signup) w ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.signUp({ @@ -1074,7 +1082,7 @@ You should present a form to the user so they can input the 6 digit pin, then se ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { @@ -1158,7 +1166,7 @@ Call the function to sign in with the user's phone number and password: ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.signInWithPassword({ diff --git a/apps/docs/content/guides/auth/quickstarts/nextjs.mdx b/apps/docs/content/guides/auth/quickstarts/nextjs.mdx index 69e6a29ef44..488d11d1ed8 100644 --- a/apps/docs/content/guides/auth/quickstarts/nextjs.mdx +++ b/apps/docs/content/guides/auth/quickstarts/nextjs.mdx @@ -60,7 +60,7 @@ hideToc: true ```text name=.env.local NEXT_PUBLIC_SUPABASE_URL=your-project-url - NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key + NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon key ``` diff --git a/apps/docs/content/guides/auth/quickstarts/react-native.mdx b/apps/docs/content/guides/auth/quickstarts/react-native.mdx index 45d125f9074..71a0a669a19 100644 --- a/apps/docs/content/guides/auth/quickstarts/react-native.mdx +++ b/apps/docs/content/guides/auth/quickstarts/react-native.mdx @@ -77,7 +77,7 @@ hideToc: true import { createClient, processLock } from '@supabase/supabase-js' const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL - const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY + const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { diff --git a/apps/docs/content/guides/auth/quickstarts/react.mdx b/apps/docs/content/guides/auth/quickstarts/react.mdx index 04b1d087a78..af12c47789d 100644 --- a/apps/docs/content/guides/auth/quickstarts/react.mdx +++ b/apps/docs/content/guides/auth/quickstarts/react.mdx @@ -78,7 +78,7 @@ hideToc: true import { Auth } from '@supabase/auth-ui-react' import { ThemeSupa } from '@supabase/auth-ui-shared' - const supabase = createClient('https://.supabase.co', '') + const supabase = createClient('https://.supabase.co', '') export default function App() { const [session, setSession] = useState(null) diff --git a/apps/docs/content/guides/auth/server-side/creating-a-client.mdx b/apps/docs/content/guides/auth/server-side/creating-a-client.mdx index 7e8a38450e9..08e8649f1d4 100644 --- a/apps/docs/content/guides/auth/server-side/creating-a-client.mdx +++ b/apps/docs/content/guides/auth/server-side/creating-a-client.mdx @@ -50,7 +50,7 @@ In your environment variables file, set your Supabase URL and Supabase Anon Key: ```bash .env.local NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url -NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` @@ -58,7 +58,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key ```bash .env.local PUBLIC_SUPABASE_URL=your_supabase_project_url -PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key +PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` @@ -66,7 +66,7 @@ PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key ```bash .env PUBLIC_SUPABASE_URL=your_supabase_project_url -PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key +PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` @@ -74,7 +74,7 @@ PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key ```bash .env SUPABASE_URL=your_supabase_project_url -SUPABASE_ANON_KEY=your_supabase_anon_key +SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` @@ -90,7 +90,7 @@ SUPABASE_ANON_KEY=your_supabase_anon_key ```bash .env SUPABASE_URL=your_supabase_project_url -SUPABASE_ANON_KEY=your_supabase_anon_key +SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` Install [dotenv](https://www.npmjs.com/package/dotenv): @@ -134,7 +134,7 @@ pnpm add dotenv ```bash .env SUPABASE_URL=your_supabase_project_url -SUPABASE_ANON_KEY=your_supabase_anon_key +SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon keyY ``` @@ -172,7 +172,7 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } ``` @@ -190,7 +190,7 @@ export async function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -252,7 +252,7 @@ export async function updateSession(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -324,12 +324,12 @@ export async function updateSession(request: NextRequest) { ```ts hooks.server.ts -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createServerClient } from '@supabase/ssr' import type { Handle } from '@sveltejs/kit' export const handle: Handle = async ({ event, resolve }) => { - event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { return event.cookies.getAll() @@ -388,7 +388,7 @@ export const handle: Handle = async ({ event, resolve }) => { Page components can get access to the Supabase client from the `data` object due to this load function. ```ts +layout.ts -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import type { LayoutLoad } from './$types' import { createBrowserClient, createServerClient, isBrowser } from '@supabase/ssr' @@ -396,12 +396,12 @@ export const load: LayoutLoad = async ({ fetch, data, depends }) => { depends('supabase:auth') const supabase = isBrowser() - ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, }) - : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, @@ -475,7 +475,7 @@ import { createServerClient, parseCookieHeader } from "@supabase/ssr"; const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -501,7 +501,7 @@ const supabase = createServerClient( const supabase = createBrowserClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY ); ``` @@ -517,7 +517,7 @@ import type { APIContext } from "astro"; export async function GET(context: APIContext) { const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -546,7 +546,7 @@ import { defineMiddleware } from 'astro:middleware' export const onRequest = defineMiddleware(async (context, next) => { const supabase = createServerClient( import.meta.env.PUBLIC_SUPABASE_URL, - import.meta.env.PUBLIC_SUPABASE_ANON_KEY, + import.meta.env.PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -587,18 +587,22 @@ import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@s export async function loader({ request }: LoaderFunctionArgs) { const headers = new Headers() - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - cookies: { - getAll() { - return parseCookieHeader(request.headers.get('Cookie') ?? '') + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + cookies: { + getAll() { + return parseCookieHeader(request.headers.get('Cookie') ?? '') + }, + setAll(cookiesToSet) { + cookiesToSet.forEach(({ name, value, options }) => + headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) + ) + }, }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) - }, - }, - }) + } + ) return new Response('...', { headers, @@ -617,18 +621,22 @@ import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@s export async function action({ request }: ActionFunctionArgs) { const headers = new Headers() - const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, { - cookies: { - getAll() { - return parseCookieHeader(request.headers.get('Cookie') ?? '') + const supabase = createServerClient( + process.env.SUPABASE_URL!, + process.env.SUPABASE_PUBLISHABLE_KEY!, + { + cookies: { + getAll() { + return parseCookieHeader(request.headers.get('Cookie') ?? '') + }, + setAll(cookiesToSet) { + cookiesToSet.forEach(({ name, value, options }) => + headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) + ) + }, }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) - }, - }, - }) + } + ) return new Response('...', { headers, @@ -649,7 +657,7 @@ export async function loader({}: LoaderFunctionArgs) { return { env: { SUPABASE_URL: process.env.SUPABASE_URL!, - SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY!, + SUPABASE_PUBLISHABLE_KEY: process.env.SUPABASE_PUBLISHABLE_KEY!, }, }; } @@ -657,7 +665,7 @@ export async function loader({}: LoaderFunctionArgs) { export default function Index() { const { env } = useLoaderData(); - const supabase = createBrowserClient(env.SUPABASE_URL, env.SUPABASE_ANON_KEY); + const supabase = createBrowserClient(env.SUPABASE_URL, env.SUPABASE_PUBLISHABLE_KEY); return ... } @@ -782,7 +790,7 @@ export default function Index() { const { createServerClient, parseCookieHeader, serializeCookieHeader } = require('@supabase/ssr') exports.createClient = (context) => { - return createServerClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY, { + return createServerClient(process.env.SUPABASE_URL, process.env.SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { return parseCookieHeader(context.req.headers.cookie ?? '') @@ -853,21 +861,21 @@ export const getSupabase = (c: Context) => { type SupabaseEnv = { SUPABASE_URL: string - SUPABASE_ANON_KEY: string + SUPABASE_PUBLISHABLE_KEY: string } export const supabaseMiddleware = (): MiddlewareHandler => { return async (c, next) => { const supabaseEnv = env(c) const supabaseUrl = supabaseEnv.SUPABASE_URL - const supabaseAnonKey = supabaseEnv.SUPABASE_ANON_KEY + const supabaseAnonKey = supabaseEnv.SUPABASE_PUBLISHABLE_KEY if (!supabaseUrl) { throw new Error('SUPABASE_URL missing!') } if (!supabaseAnonKey) { - throw new Error('SUPABASE_ANON_KEY missing!') + throw new Error('SUPABASE_PUBLISHABLE_KEY missing!') } const supabase = createServerClient(supabaseUrl, supabaseAnonKey, { diff --git a/apps/docs/content/guides/auth/server-side/nextjs.mdx b/apps/docs/content/guides/auth/server-side/nextjs.mdx index 0443da17257..ca43981674c 100644 --- a/apps/docs/content/guides/auth/server-side/nextjs.mdx +++ b/apps/docs/content/guides/auth/server-side/nextjs.mdx @@ -36,7 +36,7 @@ npm install @supabase/supabase-js @supabase/ssr Create a `.env.local` file in your project root directory. -Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY`: +Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`: @@ -49,7 +49,7 @@ Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY`: ```txt name=.env.local NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` @@ -120,7 +120,7 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } ``` @@ -134,7 +134,7 @@ export async function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -232,7 +232,7 @@ export async function updateSession(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -557,7 +557,7 @@ npm install @supabase/supabase-js @supabase/ssr Create a `.env.local` file in your project root directory. -Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY`: +Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`: @@ -568,7 +568,7 @@ Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY`: ```txt name=.env.local NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` @@ -640,7 +640,7 @@ import { createServerClient, serializeCookieHeader } from '@supabase/ssr' export function createClient({ req, res }: GetServerSidePropsContext) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -668,7 +668,7 @@ import { createClient as createClientPrimitive } from '@supabase/supabase-js' export function createClient() { const supabase = createClientPrimitive( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) return supabase @@ -681,7 +681,7 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { const supabase = createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) return supabase @@ -695,7 +695,7 @@ import { type NextApiRequest, type NextApiResponse } from 'next' export default function createClient(req: NextApiRequest, res: NextApiResponse) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/docs/content/guides/auth/server-side/sveltekit.mdx b/apps/docs/content/guides/auth/server-side/sveltekit.mdx index f8b0719df4b..81db989fa9e 100644 --- a/apps/docs/content/guides/auth/server-side/sveltekit.mdx +++ b/apps/docs/content/guides/auth/server-side/sveltekit.mdx @@ -31,7 +31,7 @@ npm install @supabase/supabase-js @supabase/ssr Create a `.env.local` file in your project root directory. -Fill in your `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_ANON_KEY`: +Fill in your `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_PUBLISHABLE_KEY`: @@ -44,7 +44,7 @@ Fill in your `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_ANON_KEY`: ```txt name=.env.local PUBLIC_SUPABASE_URL= -PUBLIC_SUPABASE_ANON_KEY= +PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` @@ -74,7 +74,7 @@ import { createServerClient } from '@supabase/ssr' import { type Handle, redirect } from '@sveltejs/kit' import { sequence } from '@sveltejs/kit/hooks' -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' const supabase: Handle = async ({ event, resolve }) => { /** @@ -82,7 +82,7 @@ const supabase: Handle = async ({ event, resolve }) => { * * The Supabase client gets the Auth token from the request cookies. */ - event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll: () => event.cookies.getAll(), /** @@ -215,7 +215,7 @@ Create a Supabase client in your root `+layout.ts`. This client can be used to a ```ts name=src/routes/+layout.ts import { createBrowserClient, createServerClient, isBrowser } from '@supabase/ssr' -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import type { LayoutLoad } from './$types' export const load: LayoutLoad = async ({ data, depends, fetch }) => { @@ -226,12 +226,12 @@ export const load: LayoutLoad = async ({ data, depends, fetch }) => { depends('supabase:auth') const supabase = isBrowser() - ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, }) - : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, diff --git a/apps/docs/content/guides/auth/sessions.mdx b/apps/docs/content/guides/auth/sessions.mdx index 6cded62c576..b83940ccba2 100644 --- a/apps/docs/content/guides/auth/sessions.mdx +++ b/apps/docs/content/guides/auth/sessions.mdx @@ -130,7 +130,7 @@ Because of this, the Supabase JavaScript libraries provide only limited support. ```typescript import { createClient } from '@supabase/supabase-js' -const supabase = createClient('SUPABASE_URL', 'SUPABASE_ANON_KEY', { +const supabase = createClient('SUPABASE_URL', 'SUPABASE_PUBLISHABLE_KEY', { auth: { storage: { getItem: () => { diff --git a/apps/docs/content/guides/auth/sessions/pkce-flow.mdx b/apps/docs/content/guides/auth/sessions/pkce-flow.mdx index 92a4cb5fc8e..e05585ea987 100644 --- a/apps/docs/content/guides/auth/sessions/pkce-flow.mdx +++ b/apps/docs/content/guides/auth/sessions/pkce-flow.mdx @@ -63,7 +63,7 @@ Putting it all together, your client library initialization may look like this: import { createClient } from '@supabase/supabase-js' // ---cut--- -const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { +const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', { // ... auth: { // ... diff --git a/apps/docs/content/guides/auth/signout.mdx b/apps/docs/content/guides/auth/signout.mdx index fb7afec649f..66cbd826f11 100644 --- a/apps/docs/content/guides/auth/signout.mdx +++ b/apps/docs/content/guides/auth/signout.mdx @@ -18,7 +18,10 @@ Call the sign out method from the client library. It removes the active session ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { @@ -82,7 +85,10 @@ You can invoke these by providing the `scope` option: ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- // defaults to the global scope diff --git a/apps/docs/content/guides/auth/social-login/auth-apple.mdx b/apps/docs/content/guides/auth/social-login/auth-apple.mdx index 0751f22c12e..98d33c6856c 100644 --- a/apps/docs/content/guides/auth/social-login/auth-apple.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-apple.mdx @@ -43,7 +43,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app, ```ts import { createClient } from '@supabase/supabase-js' - const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') + const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- supabase.auth.signInWithOAuth({ diff --git a/apps/docs/content/guides/auth/social-login/auth-azure.mdx b/apps/docs/content/guides/auth/social-login/auth-azure.mdx index 1057da8f831..c9176e917ee 100644 --- a/apps/docs/content/guides/auth/social-login/auth-azure.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-azure.mdx @@ -150,7 +150,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signInWithAzure() { @@ -210,7 +210,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signOut() { @@ -258,7 +258,7 @@ Azure OAuth2.0 doesn't return the `provider_refresh_token` by default. If you ne ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signInWithAzure() { diff --git a/apps/docs/content/guides/auth/social-login/auth-bitbucket.mdx b/apps/docs/content/guides/auth/social-login/auth-bitbucket.mdx index 50b1be00155..24eb3432ac0 100644 --- a/apps/docs/content/guides/auth/social-login/auth-bitbucket.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-bitbucket.mdx @@ -61,7 +61,10 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signInWithBitbucket() { @@ -116,7 +119,10 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-discord.mdx b/apps/docs/content/guides/auth/social-login/auth-discord.mdx index 18992be42c0..927854fdef2 100644 --- a/apps/docs/content/guides/auth/social-login/auth-discord.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-discord.mdx @@ -78,7 +78,10 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signInWithDiscord() { @@ -135,7 +138,10 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-facebook.mdx b/apps/docs/content/guides/auth/social-login/auth-facebook.mdx index b8f17ff2bd5..f6a0d5538cb 100644 --- a/apps/docs/content/guides/auth/social-login/auth-facebook.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-facebook.mdx @@ -95,7 +95,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signInWithFacebook() { @@ -170,7 +170,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-figma.mdx b/apps/docs/content/guides/auth/social-login/auth-figma.mdx index 9b3701f9a9c..6fd11bdc0c9 100644 --- a/apps/docs/content/guides/auth/social-login/auth-figma.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-figma.mdx @@ -61,7 +61,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithFigma() { @@ -116,7 +116,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-github.mdx b/apps/docs/content/guides/auth/social-login/auth-github.mdx index 49dcbe799c6..2953ad223a8 100644 --- a/apps/docs/content/guides/auth/social-login/auth-github.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-github.mdx @@ -73,7 +73,10 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signInWithGithub() { @@ -142,7 +145,10 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-gitlab.mdx b/apps/docs/content/guides/auth/social-login/auth-gitlab.mdx index 186759e0a9a..56df4e93f72 100644 --- a/apps/docs/content/guides/auth/social-login/auth-gitlab.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-gitlab.mdx @@ -58,7 +58,10 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signInWithGitLab() { @@ -113,7 +116,10 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-google.mdx b/apps/docs/content/guides/auth/social-login/auth-google.mdx index 59f7a780215..be691bad7f7 100644 --- a/apps/docs/content/guides/auth/social-login/auth-google.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-google.mdx @@ -270,7 +270,7 @@ Google does not send out a refresh token by default, so you will need to pass pa ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project.supabase.co', 'your-anon-key') +const supabase = createClient('https://your-project.supabase.co', 'sb_publishable_... or anon key') // ---cut--- const { data, error } = await supabase.auth.signInWithOAuth({ diff --git a/apps/docs/content/guides/auth/social-login/auth-kakao.mdx b/apps/docs/content/guides/auth/social-login/auth-kakao.mdx index 29dbceb668e..950c50f67bb 100644 --- a/apps/docs/content/guides/auth/social-login/auth-kakao.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-kakao.mdx @@ -85,7 +85,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithKakao() { diff --git a/apps/docs/content/guides/auth/social-login/auth-keycloak.mdx b/apps/docs/content/guides/auth/social-login/auth-keycloak.mdx index 48d0598698e..73ec7c240af 100644 --- a/apps/docs/content/guides/auth/social-login/auth-keycloak.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-keycloak.mdx @@ -76,7 +76,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithKeycloak() { @@ -158,7 +158,7 @@ When your user signs out, call [signOut()](/docs/reference/kotlin/auth-signout) ```kotlin import { createClient } from '@supabase/supabase-js'; -const supabase = createClient('', ''); +const supabase = createClient('', ''); // ---cut--- suspend fun signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-linkedin.mdx b/apps/docs/content/guides/auth/social-login/auth-linkedin.mdx index 251b54e22ba..8a04410f563 100644 --- a/apps/docs/content/guides/auth/social-login/auth-linkedin.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-linkedin.mdx @@ -81,7 +81,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithLinkedIn() { @@ -136,7 +136,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-notion.mdx b/apps/docs/content/guides/auth/social-login/auth-notion.mdx index d51dc093b06..4b3b115b9dc 100644 --- a/apps/docs/content/guides/auth/social-login/auth-notion.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-notion.mdx @@ -61,7 +61,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithNotion() { @@ -116,7 +116,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-slack.mdx b/apps/docs/content/guides/auth/social-login/auth-slack.mdx index 25593c498aa..e1715289ba5 100644 --- a/apps/docs/content/guides/auth/social-login/auth-slack.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-slack.mdx @@ -97,7 +97,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithSlack() { @@ -152,7 +152,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-spotify.mdx b/apps/docs/content/guides/auth/social-login/auth-spotify.mdx index c160594c60d..6c74d83480c 100644 --- a/apps/docs/content/guides/auth/social-login/auth-spotify.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-spotify.mdx @@ -91,7 +91,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithSpotify() { @@ -146,7 +146,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-twitch.mdx b/apps/docs/content/guides/auth/social-login/auth-twitch.mdx index dbb3b4458bf..ad356b654af 100644 --- a/apps/docs/content/guides/auth/social-login/auth-twitch.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-twitch.mdx @@ -76,7 +76,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithTwitch() { @@ -131,7 +131,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-twitter.mdx b/apps/docs/content/guides/auth/social-login/auth-twitter.mdx index f1ed101fbc1..b78996ceba3 100644 --- a/apps/docs/content/guides/auth/social-login/auth-twitter.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-twitter.mdx @@ -85,7 +85,10 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signInWithTwitter() { @@ -140,7 +143,10 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://your-project-id.supabase.co', 'your-anon-key') +const supabase = createClient( + 'https://your-project-id.supabase.co', + 'sb_publishable_... or anon key' +) // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/social-login/auth-workos.mdx b/apps/docs/content/guides/auth/social-login/auth-workos.mdx index ecd807b8528..a41f9df64d4 100644 --- a/apps/docs/content/guides/auth/social-login/auth-workos.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-workos.mdx @@ -73,7 +73,7 @@ When a user signs in, call `signInWithOAuth` with `workos` as the provider. ```javascript import { createClient } from '@supabase/supabase-js'; -const supabase = createClient('', ''); +const supabase = createClient('', ''); const redirect = (url: string) => {} // ---cut--- diff --git a/apps/docs/content/guides/auth/social-login/auth-zoom.mdx b/apps/docs/content/guides/auth/social-login/auth-zoom.mdx index 4c961dec1d1..71bbe5d6f96 100644 --- a/apps/docs/content/guides/auth/social-login/auth-zoom.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-zoom.mdx @@ -92,7 +92,7 @@ When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/a ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signInWithZoom() { @@ -147,7 +147,7 @@ When your user signs out, call [signOut()](/docs/reference/javascript/auth-signo ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('', '') +const supabase = createClient('', '') // ---cut--- async function signOut() { diff --git a/apps/docs/content/guides/auth/third-party/auth0.mdx b/apps/docs/content/guides/auth/third-party/auth0.mdx index 097dd6cabe9..76cf04be643 100644 --- a/apps/docs/content/guides/auth/third-party/auth0.mdx +++ b/apps/docs/content/guides/auth/third-party/auth0.mdx @@ -31,16 +31,20 @@ const auth0 = new Auth0Client({ }, }) -const supabase = createClient('https://.supabase.co', 'SUPABASE_ANON_KEY', { - accessToken: async () => { - const accessToken = await auth0.getTokenSilently() +const supabase = createClient( + 'https://.supabase.co', + 'SUPABASE_PUBLISHABLE_KEY', + { + accessToken: async () => { + const accessToken = await auth0.getTokenSilently() - // Alternatively you can use (await auth0.getIdTokenClaims()).__raw to - // use an ID token instead. + // Alternatively you can use (await auth0.getIdTokenClaims()).__raw to + // use an ID token instead. - return accessToken - }, -}) + return accessToken + }, + } +) ``` @@ -57,7 +61,7 @@ extension CredentialsManager { let supabase = SupabaseClient( supabaseURL: URL(string: "https://.supabase.co")!, - supabaseKey: "SUPABASE_ANON_KEY", + supabaseKey: "SUPABASE_PUBLISHABLE_KEY", options: SupabaseClientOptions( auth: SupabaseClientOptions.AuthOptions( accessToken: { @@ -81,7 +85,7 @@ Future main() async { final auth0 = Auth0('AUTH0_DOMAIN', 'AUTH0_CLIENT_ID'); await Supabase.initialize( url: 'https://.supabase.co', - anonKey: 'SUPABASE_ANON_KEY', + anonKey: 'SUPABASE_PUBLISHABLE_KEY', accessToken: () async { final credentials = await auth0.credentialsManager.credentials(); return credentials.accessToken; @@ -100,7 +104,7 @@ import com.auth0.android.result.Credentials val supabase = createSupabaseClient( "https://.supabase.co", - "SUPABASE_ANON_KEY" + "SUPABASE_PUBLISHABLE_KEY" ) { accessToken = { val credentials: Credentials = ...; // Get credentials from Auth0 diff --git a/apps/docs/content/guides/auth/third-party/aws-cognito.mdx b/apps/docs/content/guides/auth/third-party/aws-cognito.mdx index 183d5f8f6e6..d2ced1133a8 100644 --- a/apps/docs/content/guides/auth/third-party/aws-cognito.mdx +++ b/apps/docs/content/guides/auth/third-party/aws-cognito.mdx @@ -22,14 +22,18 @@ Amazon Cognito User Pools (via AWS Amplify or on its own) can be used as a third ```typescript import { fetchAuthSession, Hub } from 'aws-amplify/auth' -const supabase = createClient('https://.supabase.co', 'SUPABASE_ANON_KEY', { - accessToken: async () => { - const tokens = await fetchAuthSession() +const supabase = createClient( + 'https://.supabase.co', + 'SUPABASE_PUBLISHABLE_KEY', + { + accessToken: async () => { + const tokens = await fetchAuthSession() - // Alternatively you can use tokens?.idToken instead. - return tokens?.accessToken - }, -}) + // Alternatively you can use tokens?.idToken instead. + return tokens?.accessToken + }, + } +) // if you're using Realtime you also need to set up a listener for Cognito auth changes Hub.listen('auth', () => { @@ -49,7 +53,7 @@ struct UnexpectedAuthSessionError: Error {} let supabase = SupabaseClient( supabaseURL: URL(string: "https://.supabase.co")!, - supabaseKey: "SUPABASE_ANON_KEY", + supabaseKey: "SUPABASE_PUBLISHABLE_KEY", options: SupabaseClientOptions( auth: SupabaseClientOptions.AuthOptions( accessToken: { @@ -80,7 +84,7 @@ import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { await Supabase.initialize( url: 'https://.supabase.co', - anonKey: 'SUPABASE_ANON_KEY', + anonKey: 'SUPABASE_PUBLISHABLE_KEY', accessToken: () async { final session = await Amplify.Auth.fetchAuthSession(); final cognitoSession = session as CognitoAuthSession; @@ -102,7 +106,7 @@ import com.amplifyframework.core.Amplify val supabase = createSupabaseClient( "https://.supabase.co", - "SUPABASE_ANON_KEY" + "SUPABASE_PUBLISHABLE_KEY" ) { accessToken = { getAccessToken() diff --git a/apps/docs/content/guides/auth/third-party/clerk.mdx b/apps/docs/content/guides/auth/third-party/clerk.mdx index 852eb4dedc2..f860db26d15 100644 --- a/apps/docs/content/guides/auth/third-party/clerk.mdx +++ b/apps/docs/content/guides/auth/third-party/clerk.mdx @@ -54,7 +54,7 @@ import 'package:supabase_flutter/supabase_flutter.dart'; await Supabase.initialize( url: 'SUPABASE_URL', - anonKey: 'SUPABASE_ANON_KEY', + anonKey: 'SUPABASE_PUBLISHABLE_KEY', accessToken: () async { final token = await ClerkAuth.of(context).sessionToken(); return token.jwt; diff --git a/apps/docs/content/guides/auth/third-party/firebase-auth.mdx b/apps/docs/content/guides/auth/third-party/firebase-auth.mdx index 6cc9b93f214..438141cd5a0 100644 --- a/apps/docs/content/guides/auth/third-party/firebase-auth.mdx +++ b/apps/docs/content/guides/auth/third-party/firebase-auth.mdx @@ -25,11 +25,15 @@ Creating a client for the Web is as easy as passing the `accessToken` async func ```typescript import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', 'SUPABASE_ANON_KEY', { - accessToken: async () => { - return (await firebase.auth().currentUser?.getIdToken(/* forceRefresh */ false)) ?? null - }, -}) +const supabase = createClient( + 'https://.supabase.co', + 'SUPABASE_PUBLISHABLE_KEY', + { + accessToken: async () => { + return (await firebase.auth().currentUser?.getIdToken(/* forceRefresh */ false)) ?? null + }, + } +) ``` Make sure the all users in your application have the `role: 'authenticated'` [custom claim](https://firebase.google.com/docs/auth/admin/custom-claims) set. If you're using the `onCreate` Cloud Function to add this custom claim to newly signed up users, you will need to call `getIdToken(/* forceRefresh */ true)` immediately after sign up as the `onCreate` function does not run synchronously. @@ -66,7 +70,7 @@ struct MissingFirebaseTokenError: Error {} let supabase = SupabaseClient( supabaseURL: URL(string: "https://.supabase.co")!, - supabaseKey: "SUPABASE_ANON_KEY", + supabaseKey: "SUPABASE_PUBLISHABLE_KEY", options: SupabaseClientOptions( auth: SupabaseClientOptions.AuthOptions( accessToken: { @@ -93,7 +97,7 @@ import com.google.firebase.ktx.Firebase val supabase = createSupabaseClient( "https://.supabase.co", - "SUPABASE_ANON_KEY" + "SUPABASE_PUBLISHABLE_KEY" ) { accessToken = { Firebase.auth.currentUser?.getIdToken(false)?.await()?.token @@ -113,7 +117,7 @@ import dev.gitlive.firebase.auth.auth val supabase = createSupabaseClient( "https://.supabase.co", - "SUPABASE_ANON_KEY" + "SUPABASE_PUBLISHABLE_KEY" ) { accessToken = { Firebase.auth.currentUser?.getIdToken(false) diff --git a/apps/docs/content/guides/auth/third-party/workos.mdx b/apps/docs/content/guides/auth/third-party/workos.mdx index 341a4b75f48..3edbf1d9d92 100644 --- a/apps/docs/content/guides/auth/third-party/workos.mdx +++ b/apps/docs/content/guides/auth/third-party/workos.mdx @@ -26,11 +26,15 @@ const authkit = await createAuthKitClient('WORKOS_CLIENT_ID', { apiHostname: '', }) -const supabase = createClient('https://.supabase.co', 'SUPABASE_ANON_KEY', { - accessToken: async () => { - return authkit.getAccessToken() - }, -}) +const supabase = createClient( + 'https://.supabase.co', + 'SUPABASE_PUBLISHABLE_KEY', + { + accessToken: async () => { + return authkit.getAccessToken() + }, + } +) ``` diff --git a/apps/docs/content/guides/functions/auth.mdx b/apps/docs/content/guides/functions/auth.mdx index ca91575b35c..7e8959a6368 100644 --- a/apps/docs/content/guides/functions/auth.mdx +++ b/apps/docs/content/guides/functions/auth.mdx @@ -25,7 +25,7 @@ import { createClient } from 'npm:@supabase/supabase-js@2' Deno.serve(async (req: Request) => { const supabaseClient = createClient( Deno.env.get('SUPABASE_URL') ?? '', - Deno.env.get('SUPABASE_ANON_KEY') ?? '', + Deno.env.get('SUPABASE_PUBLISHABLE_KEY') ?? '', // Create client with Auth context of the user that called the function. // This way your row-level-security (RLS) policies are applied. { diff --git a/apps/docs/content/guides/functions/connect-to-postgres.mdx b/apps/docs/content/guides/functions/connect-to-postgres.mdx index 4a046611bdf..2422a3a7169 100644 --- a/apps/docs/content/guides/functions/connect-to-postgres.mdx +++ b/apps/docs/content/guides/functions/connect-to-postgres.mdx @@ -22,7 +22,7 @@ Deno.serve(async (req) => { try { const supabase = createClient( Deno.env.get('SUPABASE_URL') ?? '', - Deno.env.get('SUPABASE_ANON_KEY') ?? '', + Deno.env.get('SUPABASE_PUBLISHABLE_KEY') ?? '', { global: { headers: { Authorization: req.headers.get('Authorization')! } } } ) diff --git a/apps/docs/content/guides/functions/deploy.mdx b/apps/docs/content/guides/functions/deploy.mdx index 41fa14063cd..f8dcbfaa92b 100644 --- a/apps/docs/content/guides/functions/deploy.mdx +++ b/apps/docs/content/guides/functions/deploy.mdx @@ -103,7 +103,7 @@ curl --request POST 'https://.supabase.co/functions/v1/hello-world' import { createClient } from '@supabase/supabase-js' // Create a single supabase client for interacting with your database -const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key') +const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key') const { data, error } = await supabase.functions.invoke('hello-world', { body: { name: 'Functions' }, @@ -114,7 +114,7 @@ const { data, error } = await supabase.functions.invoke('hello-world', { -Note that the `SUPABASE_ANON_KEY` is different in development and production. To get your production anon key, you can find it in your Supabase dashboard under Settings > API. +Note that the `SUPABASE_PUBLISHABLE_KEY` is different in development and production. To get your production anon key, you can find it in your Supabase dashboard under Settings > API. diff --git a/apps/docs/content/guides/functions/quickstart.mdx b/apps/docs/content/guides/functions/quickstart.mdx index 0ce71d267db..5183045193d 100644 --- a/apps/docs/content/guides/functions/quickstart.mdx +++ b/apps/docs/content/guides/functions/quickstart.mdx @@ -115,7 +115,7 @@ Open a new terminal and test your function with curl: -**Need your `SUPABASE_ANON_KEY`?** +**Need your `SUPABASE_PUBLISHABLE_KEY`?** Run `supabase status` to see your local anon key and other credentials. @@ -123,7 +123,7 @@ Run `supabase status` to see your local anon key and other credentials. ```bash curl -i --location --request POST 'http://localhost:54321/functions/v1/hello-world' \ - --header 'Authorization: Bearer SUPABASE_ANON_KEY' \ + --header 'Authorization: Bearer SUPABASE_PUBLISHABLE_KEY' \ --header 'Content-Type: application/json' \ --data '{"name":"Functions"}' ``` @@ -229,7 +229,7 @@ Now, you should have your Edge Function deployed and running globally at `https: ```bash curl --request POST 'https://[YOUR_PROJECT_ID].supabase.co/functions/v1/hello-world' \ - --header 'Authorization: Bearer SUPABASE_ANON_KEY' \ + --header 'Authorization: Bearer SUPABASE_PUBLISHABLE_KEY' \ --header 'Content-Type: application/json' \ --data '{"name":"Production"}' ``` @@ -242,7 +242,7 @@ curl --request POST 'https://[YOUR_PROJECT_ID].supabase.co/functions/v1/hello-wo -The `SUPABASE_ANON_KEY` is different in development and production. To get your production anon key, you can find it in your Supabase dashboard under **Settings > API**. +The `SUPABASE_PUBLISHABLE_KEY` is different in development and production. To get your production anon key, you can find it in your Supabase dashboard under **Settings > API**. diff --git a/apps/docs/content/guides/functions/schedule-functions.mdx b/apps/docs/content/guides/functions/schedule-functions.mdx index 254a37dad92..bef637ca04e 100644 --- a/apps/docs/content/guides/functions/schedule-functions.mdx +++ b/apps/docs/content/guides/functions/schedule-functions.mdx @@ -31,7 +31,7 @@ Store `project_url` and `anon_key` in Supabase Vault: ```sql select vault.create_secret('https://project-ref.supabase.co', 'project_url'); -select vault.create_secret('YOUR_SUPABASE_ANON_KEY', 'anon_key'); +select vault.create_secret('YOUR_SUPABASE_PUBLISHABLE_KEY', 'publishable_key'); ``` Make a POST request to a Supabase Edge Function every minute: diff --git a/apps/docs/content/guides/functions/secrets.mdx b/apps/docs/content/guides/functions/secrets.mdx index 64bd3223007..5a7a5ff431a 100644 --- a/apps/docs/content/guides/functions/secrets.mdx +++ b/apps/docs/content/guides/functions/secrets.mdx @@ -10,7 +10,7 @@ subtitle: 'Manage sensitive data securely across environments.' Edge Functions have access to these secrets by default: - `SUPABASE_URL`: The API gateway for your Supabase project -- `SUPABASE_ANON_KEY`: The `anon` key for your Supabase API. This is safe to use in a browser when you have Row Level Security enabled +- `SUPABASE_PUBLISHABLE_KEY`: The `publishable` key for your Supabase API. This is safe to use in a browser when you have Row Level Security enabled - `SUPABASE_SERVICE_ROLE_KEY`: The `service_role` key for your Supabase API. This is safe to use in Edge Functions, but it should NEVER be used in a browser. This key will bypass Row Level Security - `SUPABASE_DB_URL`: The URL for your Postgres database. You can use this to connect directly to your database @@ -32,7 +32,7 @@ import { createClient } from 'npm:@supabase/supabase-js@2' // For user-facing operations (respects RLS) const supabase = createClient( Deno.env.get('SUPABASE_URL')!, - Deno.env.get('SUPABASE_ANON_KEY')! + Deno.env.get('SUPABASE_PUBLISHABLE_KEY')! ) // For admin operations (bypasses RLS) diff --git a/apps/docs/content/guides/functions/unit-test.mdx b/apps/docs/content/guides/functions/unit-test.mdx index 5986ad3087b..75f862ee9a6 100644 --- a/apps/docs/content/guides/functions/unit-test.mdx +++ b/apps/docs/content/guides/functions/unit-test.mdx @@ -48,7 +48,7 @@ import 'jsr:@std/dotenv/load' // Set up the configuration for the Supabase client const supabaseUrl = Deno.env.get('SUPABASE_URL') ?? '' -const supabaseKey = Deno.env.get('SUPABASE_ANON_KEY') ?? '' +const supabaseKey = Deno.env.get('SUPABASE_PUBLISHABLE_KEY') ?? '' const options = { auth: { autoRefreshToken: false, @@ -146,8 +146,8 @@ To locally test and debug Edge Functions, you can utilize the Supabase CLI. Let' touch .env # adds the SUPABASE_URL secret echo "SUPABASE_URL=http://localhost:54321" >> .env - # adds the SUPABASE_ANON_KEY secret - echo "SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" >> .env + # adds the SUPABASE_PUBLISHABLE_KEY secret + echo "SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" >> .env # Alternatively, you can open it in your editor: open .env ``` diff --git a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx index ec4e0efc14a..6420a59f139 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx @@ -72,7 +72,7 @@ hideToc: true await Supabase.initialize( url: 'YOUR_SUPABASE_URL', - anonKey: 'YOUR_SUPABASE_ANON_KEY', + anonKey: 'YOUR_SUPABASE_PUBLISHABLE_KEY', ); runApp(MyApp()); } diff --git a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx index 6e245725384..91f73e5616a 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx @@ -53,7 +53,7 @@ hideToc: true let supabase = SupabaseClient( supabaseURL: URL(string: "YOUR_SUPABASE_URL")!, - supabaseKey: "YOUR_SUPABASE_ANON_KEY" + supabaseKey: "YOUR_SUPABASE_PUBLISHABLE_KEY" ) ``` diff --git a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx index 14690e27cc3..70277ee447e 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx @@ -50,7 +50,7 @@ hideToc: true ```text name=.env.local NEXT_PUBLIC_SUPABASE_URL= - NEXT_PUBLIC_SUPABASE_ANON_KEY= + NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` @@ -81,7 +81,7 @@ hideToc: true return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx index bfc6a12f4cc..cad739e7e86 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx @@ -66,7 +66,7 @@ hideToc: true ```text name=.env.local SUPABASE_URL= - SUPABASE_ANON_KEY= + SUPABASE_PUBLISHABLE_KEY= ``` ```ts name=nuxt.config.tsx @@ -74,7 +74,7 @@ hideToc: true runtimeConfig: { public: { supabaseUrl: process.env.SUPABASE_URL, - supabaseAnonKey: process.env.SUPABASE_ANON_KEY, + supabaseAnonKey: process.env.SUPABASE_PUBLISHABLE_KEY, }, }, }); diff --git a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx index 50a5722cd65..af74baf522e 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx @@ -66,7 +66,7 @@ hideToc: true ```text name=.env.local VITE_SUPABASE_URL= - VITE_SUPABASE_ANON_KEY= + VITE_SUPABASE_PUBLISHABLE_KEY= ``` @@ -87,7 +87,7 @@ hideToc: true import { useEffect, useState } from "react"; import { createClient } from "@supabase/supabase-js"; - const supabase = createClient(import.meta.env.VITE_SUPABASE_URL, import.meta.env.VITE_SUPABASE_ANON_KEY); + const supabase = createClient(import.meta.env.VITE_SUPABASE_URL, import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY); function App() { const [instruments, setInstruments] = useState([]); diff --git a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx index 88fb3063b58..0646a93b22a 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx @@ -66,7 +66,7 @@ hideToc: true ```text name=.env.local VITE_SUPABASE_URL= - VITE_SUPABASE_ANON_KEY= + VITE_SUPABASE_PUBLISHABLE_KEY= ``` @@ -90,7 +90,7 @@ hideToc: true import { createClient } from "@supabase/supabase-js"; import { createResource, For } from "solid-js"; - const supabase = createClient('https://.supabase.co', ''); + const supabase = createClient('https://.supabase.co', ''); async function getInstruments() { const { data } = await supabase.from("instruments").select(); diff --git a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx index 032663d43fb..f71f5bda2b8 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx @@ -66,8 +66,8 @@ hideToc: true <$CodeTabs> ```text name=.env - PUBLIC_SUPABASE_URL= - PUBLIC_SUPABASE_ANON_KEY= + VITE_PUBLIC_SUPABASE_URL= + VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` @@ -89,16 +89,16 @@ hideToc: true ```js name=src/lib/supabaseClient.js import { createClient } from '@supabase/supabase-js'; - import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; + import { VITE_PUBLIC_SUPABASE_URL, VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; - export const supabase = createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY) + export const supabase = createClient(VITE_PUBLIC_SUPABASE_URL, VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY) ``` ```ts name=src/lib/supabaseClient.ts import { createClient } from '@supabase/supabase-js'; - import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; + import { VITE_PUBLIC_SUPABASE_URL, VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; - export const supabase = createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY) + export const supabase = createClient(VITE_PUBLIC_SUPABASE_URL, VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY) ``` diff --git a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx b/apps/docs/content/guides/getting-started/quickstarts/vue.mdx index 83b5b62d959..f98c7b35562 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/vue.mdx @@ -66,7 +66,7 @@ hideToc: true ```text name=.env.local VITE_SUPABASE_URL= - VITE_SUPABASE_ANON_KEY= + VITE_SUPABASE_PUBLISHABLE_KEY= ``` @@ -88,7 +88,7 @@ hideToc: true import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL - const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY + const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey) ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx index dea1fad9bd9..b5475206e64 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx @@ -58,7 +58,7 @@ These variables are safe to expose in your Expo app since Supabase has import { createClient } from '@supabase/supabase-js' const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL - const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY + const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { @@ -150,7 +150,7 @@ These variables are safe to expose in your Expo app since Supabase has } const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL - const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY + const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_PUBLISHABLE_KEY const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { diff --git a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx index 6b19272384b..a3c5623cb49 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx @@ -155,7 +155,7 @@ import 'package:supabase_flutter/supabase_flutter.dart'; Future main() async { await Supabase.initialize( url: 'YOUR_SUPABASE_URL', - anonKey: 'YOUR_SUPABASE_ANON_KEY', + anonKey: 'YOUR_SUPABASE_PUBLISHABLE_KEY', ); runApp(const MyApp()); } @@ -474,7 +474,7 @@ import 'package:supabase_quickstart/pages/login_page.dart'; Future main() async { await Supabase.initialize( url: 'YOUR_SUPABASE_URL', - anonKey: 'YOUR_SUPABASE_ANON_KEY', + anonKey: 'YOUR_SUPABASE_PUBLISHABLE_KEY', ); runApp(const MyApp()); } diff --git a/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx b/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx index 6d82cab6ac8..abc9e995e43 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx @@ -43,7 +43,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` @@ -57,7 +57,7 @@ on the browser, and that's completely fine since we have [Row Level Security](/d import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || '' -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || '' +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY || '' export const supabase = createClient(supabaseUrl, supabaseAnonKey) ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx b/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx index 3499a0a2e27..382904c84a2 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx @@ -43,7 +43,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` @@ -56,7 +56,7 @@ Now that we have the API credentials in place, let's create a helper file to ini import { createClient } from '@supabase/supabase-js'; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL as string; -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY as string; +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY as string; export const supabase = createClient(supabaseUrl, supabaseAnonKey); ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx b/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx index 9a54445e2fb..25dc9824ffd 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx @@ -36,7 +36,7 @@ Create or edit the `local.properties` file at the root (same level as `build.gra > **Note**: Do not commit this file to your source control, for example, by adding it to your `.gitignore` file! ```kotlin -SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY SUPABASE_URL=YOUR_SUPABASE_URL ``` @@ -56,7 +56,7 @@ defaultConfig { // Set value part Properties properties = new Properties() properties.load(project.rootProject.file("local.properties").newDataInputStream()) - buildConfigField("String", "SUPABASE_ANON_KEY", "\"${properties.getProperty("SUPABASE_ANON_KEY")}\"") + buildConfigField("String", "SUPABASE_PUBLISHABLE_KEY", "\"${properties.getProperty("SUPABASE_PUBLISHABLE_KEY")}\"") buildConfigField("String", "SECRET", "\"${properties.getProperty("SECRET")}\"") buildConfigField("String", "SUPABASE_URL", "\"${properties.getProperty("SUPABASE_URL")}\"") } @@ -68,7 +68,7 @@ Read the value from `BuildConfig`: ```kotlin val url = BuildConfig.SUPABASE_URL -val apiKey = BuildConfig.SUPABASE_ANON_KEY +val apiKey = BuildConfig.SUPABASE_PUBLISHABLE_KEY ``` ### Set up Supabase dependencies @@ -152,7 +152,7 @@ object SupabaseModule { fun provideSupabaseClient(): SupabaseClient { return createSupabaseClient( supabaseUrl = BuildConfig.SUPABASE_URL, - supabaseKey = BuildConfig.SUPABASE_ANON_KEY + supabaseKey = BuildConfig.SUPABASE_PUBLISHABLE_KEY ) { install(Postgrest) install(Auth) { diff --git a/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx index 0d060dda2e6..9c2ea9a6a38 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx @@ -58,7 +58,7 @@ Save the environment variables in a `.env.local` file at the root of the project ```bash .env.local NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL -NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` ### App styling (optional) @@ -108,7 +108,7 @@ export function createClient() { // Create a supabase client on the browser with project's credentials return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ) } ``` @@ -124,7 +124,7 @@ export async function createClient() { // which could be used to maintain user's session return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { @@ -244,7 +244,7 @@ export async function updateSession(request) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll() { diff --git a/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx b/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx index 20e45f4e4a7..465d7cb35f9 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx @@ -42,7 +42,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env SUPABASE_URL="YOUR_SUPABASE_URL" -SUPABASE_KEY="YOUR_SUPABASE_ANON_KEY" +SUPABASE_KEY="YOUR_SUPABASE_PUBLISHABLE_KEY" ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-react.mdx b/apps/docs/content/guides/getting-started/tutorials/with-react.mdx index f1089155165..671db76c406 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-react.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-react.mdx @@ -42,7 +42,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` @@ -58,7 +58,7 @@ Create and edit `src/supabaseClient.js`: import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey) ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx index 1c01d3c81e3..79d92814934 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx @@ -109,7 +109,7 @@ We need the `API URL` as well as the `anon` and `jwt_secret` keys that you copie ```bash name=.env SUPABASE_URL=YOUR_SUPABASE_URL -SUPABASE_KEY=YOUR_SUPABASE_ANON_KEY +SUPABASE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY SUPABASE_JWT_SECRET=YOUR_SUPABASE_JWT_SECRET ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx b/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx index 2d8812515b1..2d8a4b3214d 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx @@ -73,7 +73,7 @@ We'll update it with environment variables managed by Vite: import { createClient } from '@refinedev/supabase' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY export const supabaseClient = createClient(supabaseUrl, supabaseAnonKey, { db: { @@ -91,7 +91,7 @@ And then, we want to save the environment variables in a `.env.local` file. All ```bash .env.local VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` The `supabaseClient` will be used in fetch calls to Supabase endpoints from our app. As we'll see below, the client is instrumental in implementing authentication using Refine's auth provider methods and CRUD actions with appropriate data provider methods. diff --git a/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx index 08cb3e10fff..e302ac40f91 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx @@ -41,7 +41,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` @@ -55,7 +55,7 @@ on the browser, and that's completely fine since we have [Row Level Security](/d import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey) ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx b/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx index 59de68988c9..4acba3e54d5 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx @@ -42,7 +42,7 @@ All you need are the API URL and the `anon` key that you copied [earlier](#get-t ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx b/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx index 43def489bf8..27c9528c014 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx @@ -42,7 +42,7 @@ All you need are the `PUBLIC_SUPABASE_URL` and the `PUBLIC_SUPABASE_ANON_KEY` ke ```bash name=.env PUBLIC_SUPABASE_URL="YOUR_SUPABASE_URL" -PUBLIC_SUPABASE_ANON_KEY="YOUR_SUPABASE_KEY" +PUBLIC_SUPABASE_PUBLISHABLE_KEY="YOUR_SUPABASE_PUBLISHABLE_KEY" ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx index 1705ea759e4..29764e59660 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx @@ -40,7 +40,7 @@ import Supabase let supabase = SupabaseClient( supabaseURL: URL(string: "YOUR_SUPABASE_URL")!, - supabaseKey: "YOUR_SUPABASE_ANON_KEY" + supabaseKey: "YOUR_SUPABASE_PUBLISHABLE_KEY" ) ``` diff --git a/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx b/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx index f5226885807..a5a53669646 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx @@ -47,7 +47,7 @@ All we need are the API URL and the `anon` key that you copied [earlier](#get-th ```bash name=.env VITE_SUPABASE_URL=YOUR_SUPABASE_URL -VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +VITE_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEY ``` @@ -61,7 +61,7 @@ on the browser, and that's completely fine since we have [Row Level Security](/d import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey) ``` diff --git a/apps/docs/content/guides/integrations/vercel-marketplace.mdx b/apps/docs/content/guides/integrations/vercel-marketplace.mdx index 5821eeccb07..0f753e5d208 100644 --- a/apps/docs/content/guides/integrations/vercel-marketplace.mdx +++ b/apps/docs/content/guides/integrations/vercel-marketplace.mdx @@ -47,10 +47,10 @@ POSTGRES_HOST POSTGRES_PASSWORD POSTGRES_DATABASE SUPABASE_SERVICE_ROLE_KEY -SUPABASE_ANON_KEY +SUPABASE_PUBLISHABLE_KEY SUPABASE_URL SUPABASE_JWT_SECRET -NEXT_PUBLIC_SUPABASE_ANON_KEY +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY NEXT_PUBLIC_SUPABASE_URL ``` diff --git a/apps/docs/content/guides/local-development/testing/overview.mdx b/apps/docs/content/guides/local-development/testing/overview.mdx index 0d00899b510..ddc5030f781 100644 --- a/apps/docs/content/guides/local-development/testing/overview.mdx +++ b/apps/docs/content/guides/local-development/testing/overview.mdx @@ -141,7 +141,7 @@ describe('Todos RLS', () => { const USER_1_ID = crypto.randomUUID() const USER_2_ID = crypto.randomUUID() - const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!) + const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_PUBLISHABLE_KEY!) beforeAll(async () => { // Setup test data specific to this test suite diff --git a/apps/docs/content/guides/platform/custom-domains.mdx b/apps/docs/content/guides/platform/custom-domains.mdx index 32226013bb8..e4d4a5e8847 100644 --- a/apps/docs/content/guides/platform/custom-domains.mdx +++ b/apps/docs/content/guides/platform/custom-domains.mdx @@ -124,7 +124,7 @@ If you wish to use the new domain in client code, change the URL used in your Su import { createClient } from '@supabase/supabase-js' // Use a custom domain as the supabase URL -const supabase = createClient('https://api.example.com', 'public-anon-key') +const supabase = createClient('https://api.example.com', 'publishable-or-anon-key') ``` Similarly, your Edge Functions will now be available at `https://api.example.com/functions/v1/your_function_name`, and your Storage objects at `https://api.example.com/storage/v1/object/public/your_file_path.ext`. @@ -202,7 +202,7 @@ If you wish to use the new domain in client code, you can set it up like so: import { createClient } from '@supabase/supabase-js' // Use a custom domain as the supabase URL -const supabase = createClient('https://my-example-brand.supabase.co', 'public-anon-key') +const supabase = createClient('https://my-example-brand.supabase.co', 'publishable-or-anon-key') ``` When using [Sign in with Twitter](/docs/guides/auth/social-login/auth-twitter) make sure your frontend code is using the subdomain only. diff --git a/apps/docs/content/guides/realtime/broadcast.mdx b/apps/docs/content/guides/realtime/broadcast.mdx index fb544f58e5f..b81e65da6d4 100644 --- a/apps/docs/content/guides/realtime/broadcast.mdx +++ b/apps/docs/content/guides/realtime/broadcast.mdx @@ -27,7 +27,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj import { createClient } from '@supabase/supabase-js' const SUPABASE_URL = 'https://.supabase.co' - const SUPABASE_KEY = '' + const SUPABASE_KEY = '' const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) ``` @@ -41,7 +41,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj void main() async { Supabase.initialize( url: 'https://.supabase.co', - anonKey: '', + anonKey: '', ); runApp(MyApp()); } @@ -56,7 +56,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj import Supabase let SUPABASE_URL = "https://.supabase.co" - let SUPABASE_KEY = "" + let SUPABASE_KEY = "" let supabase = SupabaseClient(supabaseURL: URL(string: SUPABASE_URL)!, supabaseKey: SUPABASE_KEY) ``` @@ -66,7 +66,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj ```kotlin val supabaseUrl = "https://.supabase.co" - val supabaseKey = "" + val supabaseKey = "" val supabase = createSupabaseClient(supabaseUrl, supabaseKey) { install(Realtime) } @@ -80,7 +80,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj from supabase import acreate_client URL = "https://.supabase.co" - KEY = "" + KEY = "" async def create_supabase(): supabase = await acreate_client(URL, KEY) @@ -107,7 +107,7 @@ You can provide a callback for the `broadcast` channel to receive messages. This ```js // @noImplicitAny: false import { createClient } from '@supabase/supabase-js' - const supabase = createClient('https://.supabase.co', '') + const supabase = createClient('https://.supabase.co', '') // ---cut--- // Join a room/topic. Can be anything except for 'realtime'. diff --git a/apps/docs/content/guides/realtime/concepts.mdx b/apps/docs/content/guides/realtime/concepts.mdx index b4fbda80fa5..558cd8ba9eb 100644 --- a/apps/docs/content/guides/realtime/concepts.mdx +++ b/apps/docs/content/guides/realtime/concepts.mdx @@ -21,7 +21,7 @@ When you initialize your Supabase Realtime client, you define a `topic` that uni ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', '') +const supabase = createClient('https://.supabase.co', '') const roomOne = supabase.channel('room-one') // set your topic here ``` @@ -34,7 +34,7 @@ By default, channels are public and you need to set that you want to use a priva ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', '') +const supabase = createClient('https://.supabase.co', '') const roomOne = supabase.channel('private-room-one', { config: { private: true } }) ``` @@ -44,7 +44,7 @@ Realtime Broadcast follows the [publish-subscribe pattern](https://en.wikipedia. ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', '') +const supabase = createClient('https://.supabase.co', '') const roomOne = supabase.channel('room-one') // set your topic here // ---cut--- @@ -67,7 +67,7 @@ Presence can be used to share an individual's state with others within a Channel ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('https://.supabase.co', '') +const supabase = createClient('https://.supabase.co', '') const roomOne = supabase.channel('room-one') // set your topic here // ---cut--- diff --git a/apps/docs/content/guides/realtime/postgres-changes.mdx b/apps/docs/content/guides/realtime/postgres-changes.mdx index 3cdf5b5a1d6..993b6935fd6 100644 --- a/apps/docs/content/guides/realtime/postgres-changes.mdx +++ b/apps/docs/content/guides/realtime/postgres-changes.mdx @@ -139,7 +139,7 @@ In this example we'll set up a database table, secure it with Row Level Security const supabase = createClient( 'https://.supabase.co', - '' + '' ) ``` diff --git a/apps/docs/content/guides/realtime/presence.mdx b/apps/docs/content/guides/realtime/presence.mdx index f545643cb2d..2c599015f08 100644 --- a/apps/docs/content/guides/realtime/presence.mdx +++ b/apps/docs/content/guides/realtime/presence.mdx @@ -27,7 +27,7 @@ Go to your Supabase project's [API Settings](https://supabase.com/dashboard/proj import { createClient } from '@supabase/supabase-js' const SUPABASE_URL = 'https://.supabase.co' -const SUPABASE_KEY = '' +const SUPABASE_KEY = '' const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) ``` @@ -39,7 +39,7 @@ const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) void main() { Supabase.initialize( url: 'https://.supabase.co', - anonKey: '', + anonKey: '', ); runApp(MyApp()); @@ -53,7 +53,7 @@ final supabase = Supabase.instance.client; ```swift let supabaseURL = "https://.supabase.co" -let supabaseKey = "" +let supabaseKey = "" let supabase = SupabaseClient(supabaseURL: URL(string: supabaseURL)!, supabaseKey: supabaseKey) let realtime = supabase.realtime @@ -64,7 +64,7 @@ let realtime = supabase.realtime ```kotlin val supabaseUrl = "https://.supabase.co" -val supabaseKey = "" +val supabaseKey = "" val supabase = createSupabaseClient(supabaseUrl, supabaseKey) { install(Realtime) } @@ -77,7 +77,7 @@ val supabase = createSupabaseClient(supabaseUrl, supabaseKey) { from supabase import create_client SUPABASE_URL = 'https://.supabase.co' -SUPABASE_KEY = '' +SUPABASE_KEY = '' supabase = create_client(SUPABASE_URL, SUPABASE_KEY) ``` @@ -397,7 +397,7 @@ By default, Presence will generate a unique `UUIDv1` key on the server to track ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient('SUPABASE_URL', 'SUPABASE_ANON_KEY') +const supabase = createClient('SUPABASE_URL', 'SUPABASE_PUBLISHABLE_KEY') const channelC = supabase.channel('test', { config: { diff --git a/apps/docs/content/guides/telemetry/logs.mdx b/apps/docs/content/guides/telemetry/logs.mdx index 18073b40cd7..d27742ef11a 100644 --- a/apps/docs/content/guides/telemetry/logs.mdx +++ b/apps/docs/content/guides/telemetry/logs.mdx @@ -227,7 +227,7 @@ const options = { }, }, } -const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options) +const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', options) ``` ## Logs Explorer diff --git a/apps/docs/content/troubleshooting/how-to-migrate-from-supabase-auth-helpers-to-ssr-package-5NRunM.mdx b/apps/docs/content/troubleshooting/how-to-migrate-from-supabase-auth-helpers-to-ssr-package-5NRunM.mdx index e3ede25bc25..0c324a7d9e6 100644 --- a/apps/docs/content/troubleshooting/how-to-migrate-from-supabase-auth-helpers-to-ssr-package-5NRunM.mdx +++ b/apps/docs/content/troubleshooting/how-to-migrate-from-supabase-auth-helpers-to-ssr-package-5NRunM.mdx @@ -32,7 +32,7 @@ import { createBrowserClient } from '@supabase/ssr'; export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ); } @@ -45,7 +45,7 @@ export function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -78,7 +78,7 @@ export async function updateSession(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/docs/spec/supabase_dart_v1.yml b/apps/docs/spec/supabase_dart_v1.yml index e58342d068d..a7d3326c000 100644 --- a/apps/docs/spec/supabase_dart_v1.yml +++ b/apps/docs/spec/supabase_dart_v1.yml @@ -33,7 +33,7 @@ functions: Future main() async { await Supabase.initialize( url: 'https://xyzcompany.supabase.co', - anonKey: 'public-anon-key', + anonKey: 'publishable-or-anon-key', ); runApp(MyApp()); @@ -48,7 +48,7 @@ functions: ```dart final supabase = SupabaseClient( 'https://xyzcompany.supabase.co', - 'public-anon-key', + 'publishable-or-anon-key', ); ``` - id: sign-up diff --git a/apps/docs/spec/supabase_dart_v2.yml b/apps/docs/spec/supabase_dart_v2.yml index 82e4ab3e1ce..be74eaaf1ee 100644 --- a/apps/docs/spec/supabase_dart_v2.yml +++ b/apps/docs/spec/supabase_dart_v2.yml @@ -90,7 +90,7 @@ functions: Future main() async { await Supabase.initialize( url: 'https://xyzcompany.supabase.co', - anonKey: 'public-anon-key', + anonKey: 'publishable-or-anon-key', ); runApp(MyApp()); @@ -105,7 +105,7 @@ functions: ```dart final supabase = SupabaseClient( 'https://xyzcompany.supabase.co', - 'public-anon-key', + 'publishable-or-anon-key', ); ``` diff --git a/apps/docs/spec/supabase_js_v1.yml b/apps/docs/spec/supabase_js_v1.yml index a8bbb49e0ab..2c2eebb5b63 100644 --- a/apps/docs/spec/supabase_js_v1.yml +++ b/apps/docs/spec/supabase_js_v1.yml @@ -27,7 +27,7 @@ functions: import { createClient } from '@supabase/supabase-js' // Create a single supabase client for interacting with your database - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key') + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key') ``` - id: with-additional-parameters name: With Additional Parameters @@ -42,7 +42,7 @@ functions: persistSession: true, detectSessionInUrl: true, } - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options) + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', options) ``` - id: api-schemas name: API schemas @@ -57,7 +57,7 @@ functions: persistSession: true, detectSessionInUrl: true, } - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options) + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', options) ``` description: | By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. @@ -70,7 +70,7 @@ functions: ```js import { createClient } from '@supabase/supabase-js' - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', { fetch: fetch.bind(globalThis), }) ``` @@ -330,7 +330,7 @@ functions: const { access_token } = req.get('X-Supabase-Auth') // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") + const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key") const { user, error } = supabase.auth.setAuth(access_token) // This client will now send requests as this user @@ -368,7 +368,7 @@ functions: const { access_token } = req.get('X-Supabase-Auth') // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") + const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key") const { user, error } = supabase.auth.setAuth(access_token) // This client will now send requests as this user diff --git a/apps/docs/spec/supabase_js_v2.yml b/apps/docs/spec/supabase_js_v2.yml index 6eb80d4b262..dcaf0903309 100644 --- a/apps/docs/spec/supabase_js_v2.yml +++ b/apps/docs/spec/supabase_js_v2.yml @@ -32,7 +32,7 @@ functions: import { createClient } from '@supabase/supabase-js' // Create a single supabase client for interacting with your database - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key') + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key') ``` - id: with-custom-domain name: With a custom domain @@ -41,7 +41,7 @@ functions: import { createClient } from '@supabase/supabase-js' // Use a custom domain as the supabase URL - const supabase = createClient('https://my-custom-domain.com', 'public-anon-key') + const supabase = createClient('https://my-custom-domain.com', 'publishable-or-anon-key') ``` - id: with-additional-parameters name: With additional parameters @@ -62,7 +62,7 @@ functions: headers: { 'x-my-custom-header': 'my-app-name' }, }, } - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", options) + const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", options) ``` - id: api-schemas name: With custom schemas @@ -70,7 +70,7 @@ functions: ```js import { createClient } from '@supabase/supabase-js' - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', { // Provide a custom schema. Defaults to "public". db: { schema: 'other_schema' } }) @@ -86,7 +86,7 @@ functions: ```js import { createClient } from '@supabase/supabase-js' - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', { global: { fetch: fetch.bind(globalThis) } }) ``` @@ -102,7 +102,7 @@ functions: import { createClient } from '@supabase/supabase-js' import AsyncStorage from "@react-native-async-storage/async-storage"; - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", { + const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", { auth: { storage: AsyncStorage, autoRefreshToken: true, @@ -170,7 +170,7 @@ functions: } } - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", { + const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", { auth: { storage: new LargeSecureStore(), autoRefreshToken: true, diff --git a/apps/docs/spec/supabase_kt_v1.yml b/apps/docs/spec/supabase_kt_v1.yml index b8e67c1b51d..a1f80811d36 100644 --- a/apps/docs/spec/supabase_kt_v1.yml +++ b/apps/docs/spec/supabase_kt_v1.yml @@ -85,7 +85,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(GoTrue) install(Postgrest) @@ -98,7 +98,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(GoTrue) { alwaysAutoRefresh = false // default: true @@ -155,7 +155,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Postgrest) { defaultSchema = "schema" // default: "public" @@ -177,7 +177,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Storage) { transferTimeout = 90.seconds // Default: 120 seconds @@ -204,7 +204,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Realtime) { reconnectDelay = 5.seconds // Default: 7 seconds @@ -231,7 +231,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Functions) { //no custom settings @@ -248,7 +248,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(GraphQL) { apolloConfiguration { @@ -2086,7 +2086,7 @@ functions: isSpotlight: true code: | ```kotlin - val supabase = createSupabaseClient(supabaseURL = "https://xyzcompany.supabase.co'", supabaseKey = "public-anon-key") { ... } + val supabase = createSupabaseClient(supabaseURL = "https://xyzcompany.supabase.co'", supabaseKey = "publishable-or-anon-key") { ... } val gotrue = supabase.gotrue ``` - id: sign-up diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.yml index 1f3efc262e1..0419f3a506b 100644 --- a/apps/docs/spec/supabase_kt_v2.yml +++ b/apps/docs/spec/supabase_kt_v2.yml @@ -127,7 +127,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Auth) install(Postgrest) @@ -140,7 +140,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Auth) { alwaysAutoRefresh = false // default: true @@ -197,7 +197,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Postgrest) { defaultSchema = "schema" // default: "public" @@ -219,7 +219,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Storage) { transferTimeout = 90.seconds // Default: 120 seconds @@ -246,7 +246,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Realtime) { reconnectDelay = 5.seconds // Default: 7 seconds @@ -273,7 +273,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Functions) { //no custom settings @@ -290,7 +290,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(GraphQL) { apolloConfiguration { @@ -2816,7 +2816,7 @@ functions: isSpotlight: true code: | ```kotlin - val supabase = createSupabaseClient(supabaseURL = "https://xyzcompany.supabase.co'", supabaseKey = "public-anon-key") { ... } + val supabase = createSupabaseClient(supabaseURL = "https://xyzcompany.supabase.co'", supabaseKey = "publishable-or-anon-key") { ... } val auth = supabase.auth ``` - id: sign-up diff --git a/apps/docs/spec/supabase_kt_v3.yml b/apps/docs/spec/supabase_kt_v3.yml index f6a4988ea72..ad95a7eb62a 100644 --- a/apps/docs/spec/supabase_kt_v3.yml +++ b/apps/docs/spec/supabase_kt_v3.yml @@ -127,7 +127,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Auth) install(Postgrest) @@ -140,7 +140,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Auth) { alwaysAutoRefresh = false // default: true @@ -197,7 +197,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Postgrest) { defaultSchema = "schema" // default: "public" @@ -219,7 +219,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Storage) { transferTimeout = 90.seconds // Default: 120 seconds @@ -246,7 +246,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Realtime) { reconnectDelay = 5.seconds // Default: 7 seconds @@ -273,7 +273,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(Functions) { //no custom settings @@ -290,7 +290,7 @@ functions: ```kotlin val supabase = createSupabaseClient( supabaseUrl = "https://xyzcompany.supabase.co", - supabaseKey = "public-anon-key" + supabaseKey = "publishable-or-anon-key" ) { install(GraphQL) { apolloConfiguration { @@ -2883,7 +2883,7 @@ functions: isSpotlight: true code: | ```kotlin - val supabase = createSupabaseClient(supabaseUrl = "https://xyzcompany.supabase.co'", supabaseKey = "public-anon-key") { ... } + val supabase = createSupabaseClient(supabaseUrl = "https://xyzcompany.supabase.co'", supabaseKey = "publishable-or-anon-key") { ... } val auth = supabase.auth ``` - id: sign-up diff --git a/apps/docs/spec/supabase_swift_v1.yml b/apps/docs/spec/supabase_swift_v1.yml index f8d4b851d78..56e98c2688a 100644 --- a/apps/docs/spec/supabase_swift_v1.yml +++ b/apps/docs/spec/supabase_swift_v1.yml @@ -25,7 +25,7 @@ functions: name: Initialize Client code: | ```swift - let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key") + let client = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "publishable-or-anon-key") ``` - id: initialize-client-custom-options name: Initialize Client with custom options @@ -33,7 +33,7 @@ functions: ```swift let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: SupabaseClientOptions( db: .init( schema: "public" @@ -59,7 +59,7 @@ functions: isSpotlight: true code: | ```swift - let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key") + let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "publishable-or-anon-key") let auth = supabase.auth ``` - id: create-auth-client-with-custom-storage @@ -69,7 +69,7 @@ functions: ```swift let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: .init( auth: .init( MyCustomLocalStorage() diff --git a/apps/docs/spec/supabase_swift_v2.yml b/apps/docs/spec/supabase_swift_v2.yml index 64c83d73331..9abe0018f89 100644 --- a/apps/docs/spec/supabase_swift_v2.yml +++ b/apps/docs/spec/supabase_swift_v2.yml @@ -27,7 +27,7 @@ functions: ```swift import Supabase - let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key") + let client = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "publishable-or-anon-key") ``` - id: initialize-client-custom-options name: Initialize Client with custom options @@ -37,7 +37,7 @@ functions: let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: SupabaseClientOptions( db: .init( schema: "public" @@ -67,7 +67,7 @@ functions: let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: SupabaseClientOptions( global: SupabaseClientOptions.GlobalOptions( logger: AppLogger() @@ -83,7 +83,7 @@ functions: let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: SupabaseClientOptions( db: .init( // Provide a custom schema. Defaults to "public". @@ -155,7 +155,7 @@ functions: isSpotlight: true code: | ```swift - let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key") + let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "publishable-or-anon-key") let auth = supabase.auth ``` - id: create-auth-client-with-custom-storage @@ -165,7 +165,7 @@ functions: ```swift let supabase = SupabaseClient( supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, - supabaseKey: "public-anon-key", + supabaseKey: "publishable-or-anon-key", options: .init( auth: .init( MyCustomLocalStorage() diff --git a/examples/auth/hono/src/middleware/auth.middleware.ts b/examples/auth/hono/src/middleware/auth.middleware.ts index 24d2888a071..d9f34905000 100644 --- a/examples/auth/hono/src/middleware/auth.middleware.ts +++ b/examples/auth/hono/src/middleware/auth.middleware.ts @@ -24,7 +24,7 @@ export const supabaseMiddleware = (): MiddlewareHandler => { const supabaseEnv = env(c); const supabaseUrl = supabaseEnv.VITE_SUPABASE_URL ?? import.meta.env.VITE_SUPABASE_URL; - const supabaseAnonKey = + const supabasePublishableKey = supabaseEnv.VITE_SUPABASE_ANON_KEY ?? import.meta.env.VITE_SUPABASE_ANON_KEY; @@ -32,11 +32,11 @@ export const supabaseMiddleware = (): MiddlewareHandler => { throw new Error('SUPABASE_URL missing!'); } - if (!supabaseAnonKey) { + if (!supabasePublishableKey) { throw new Error('SUPABASE_ANON_KEY missing!'); } - const supabase = createServerClient(supabaseUrl, supabaseAnonKey, { + const supabase = createServerClient(supabaseUrl, supabasePublishableKey, { cookies: { getAll() { return parseCookieHeader(c.req.header('Cookie') ?? ''); diff --git a/examples/auth/nextjs/.env.example b/examples/auth/nextjs/.env.example index 693703197a7..5f69cea9e2d 100644 --- a/examples/auth/nextjs/.env.example +++ b/examples/auth/nextjs/.env.example @@ -1,4 +1,4 @@ # Update these with your Supabase details from your project settings > API # https://app.supabase.com/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=your-project-url -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key diff --git a/examples/auth/nextjs/README.md b/examples/auth/nextjs/README.md index 7bce067f99a..88893a38db6 100644 --- a/examples/auth/nextjs/README.md +++ b/examples/auth/nextjs/README.md @@ -67,10 +67,10 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps ``` NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL] - NEXT_PUBLIC_SUPABASE_ANON_KEY=[INSERT SUPABASE PROJECT API ANON KEY] + NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[INSERT SUPABASE PROJECT API ANON KEY] ``` - Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` can be found in [your Supabase project's API settings](https://app.supabase.com/project/_/settings/api) + Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` can be found in [your Supabase project's API settings](https://app.supabase.com/project/_/settings/api) 5. You can now run the Next.js local development server: diff --git a/examples/auth/nextjs/utils/supabase/client.ts b/examples/auth/nextjs/utils/supabase/client.ts index 06848736b2b..cb5f10d6134 100644 --- a/examples/auth/nextjs/utils/supabase/client.ts +++ b/examples/auth/nextjs/utils/supabase/client.ts @@ -3,6 +3,6 @@ import { createBrowserClient } from "@supabase/ssr" export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/examples/auth/nextjs/utils/supabase/middleware.ts b/examples/auth/nextjs/utils/supabase/middleware.ts index 237cdc0cbd7..ce48362634e 100644 --- a/examples/auth/nextjs/utils/supabase/middleware.ts +++ b/examples/auth/nextjs/utils/supabase/middleware.ts @@ -8,7 +8,7 @@ export async function updateSession(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/examples/auth/nextjs/utils/supabase/server.ts b/examples/auth/nextjs/utils/supabase/server.ts index 40633b0c5b8..aed1ce1830e 100644 --- a/examples/auth/nextjs/utils/supabase/server.ts +++ b/examples/auth/nextjs/utils/supabase/server.ts @@ -6,7 +6,7 @@ export async function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/examples/caching/with-nextjs-13-server-components/.env.local.example b/examples/caching/with-nextjs-13-server-components/.env.local.example index ebd83d9fe35..d8eda636b96 100644 --- a/examples/caching/with-nextjs-13-server-components/.env.local.example +++ b/examples/caching/with-nextjs-13-server-components/.env.local.example @@ -2,4 +2,4 @@ # https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=your-supabase-url -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-supabase-anon-key diff --git a/examples/caching/with-nextjs-13-server-components/utils/supabase.ts b/examples/caching/with-nextjs-13-server-components/utils/supabase.ts index 03729d0b486..b2fcc8a37e7 100644 --- a/examples/caching/with-nextjs-13-server-components/utils/supabase.ts +++ b/examples/caching/with-nextjs-13-server-components/utils/supabase.ts @@ -2,5 +2,5 @@ import { createClient } from '@supabase/supabase-js' export default createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) diff --git a/examples/caching/with-react-query-nextjs-14/.env.local.example b/examples/caching/with-react-query-nextjs-14/.env.local.example index 29194349328..9d02e8e3e89 100644 --- a/examples/caching/with-react-query-nextjs-14/.env.local.example +++ b/examples/caching/with-react-query-nextjs-14/.env.local.example @@ -1,3 +1,3 @@ # Find them at https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_ANON_KEY= \ No newline at end of file +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= \ No newline at end of file diff --git a/examples/caching/with-react-query-nextjs-14/utils/supabase-browser.ts b/examples/caching/with-react-query-nextjs-14/utils/supabase-browser.ts index 7fc4012f1e1..4d80fd6dbb5 100644 --- a/examples/caching/with-react-query-nextjs-14/utils/supabase-browser.ts +++ b/examples/caching/with-react-query-nextjs-14/utils/supabase-browser.ts @@ -12,7 +12,7 @@ function getSupabaseBrowserClient() { client = createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) return client diff --git a/examples/caching/with-react-query-nextjs-14/utils/supabase-server.ts b/examples/caching/with-react-query-nextjs-14/utils/supabase-server.ts index a75ab5ca9c7..42228784550 100644 --- a/examples/caching/with-react-query-nextjs-14/utils/supabase-server.ts +++ b/examples/caching/with-react-query-nextjs-14/utils/supabase-server.ts @@ -7,7 +7,7 @@ export default function useSupabaseServer( ) { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { get(name: string) { diff --git a/examples/clerk/hooks/useSupabaseClient.ts b/examples/clerk/hooks/useSupabaseClient.ts index 5c796d58e82..8b7a689310f 100644 --- a/examples/clerk/hooks/useSupabaseClient.ts +++ b/examples/clerk/hooks/useSupabaseClient.ts @@ -5,7 +5,7 @@ export function useSupabaseClient() { const { session } = useSession() const supabaseClient = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { // Session accessed from Clerk SDK, either as Clerk.session (vanilla // JavaScript) or useSession (React) diff --git a/examples/prompts/nextjs-supabase-auth.md b/examples/prompts/nextjs-supabase-auth.md index 2dfefd20561..81f44778d1f 100644 --- a/examples/prompts/nextjs-supabase-auth.md +++ b/examples/prompts/nextjs-supabase-auth.md @@ -77,7 +77,7 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } ``` @@ -93,7 +93,7 @@ export async function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { @@ -129,7 +129,7 @@ export async function middleware(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/examples/realtime/flutter-multiplayer-shooting-game/README.md b/examples/realtime/flutter-multiplayer-shooting-game/README.md index 0c1b7fcd498..fa03525a067 100644 --- a/examples/realtime/flutter-multiplayer-shooting-game/README.md +++ b/examples/realtime/flutter-multiplayer-shooting-game/README.md @@ -30,7 +30,7 @@ Copy and paste the Supabase URL and Anon key in `lib/main.dart` file void main() async { await Supabase.initialize( url: 'supabaseUrl', - anonKey: 'supabaseAnonKey', + anonKey: 'supabasePublishableKey', realtimeClientOptions: const RealtimeClientOptions(eventsPerSecond: 40), ); runApp(const MyApp()); diff --git a/examples/realtime/flutter-multiplayer-shooting-game/lib/main.dart b/examples/realtime/flutter-multiplayer-shooting-game/lib/main.dart index 9dbeb5b151a..cdfdb13c407 100644 --- a/examples/realtime/flutter-multiplayer-shooting-game/lib/main.dart +++ b/examples/realtime/flutter-multiplayer-shooting-game/lib/main.dart @@ -7,7 +7,7 @@ import 'package:uuid/uuid.dart'; void main() async { await Supabase.initialize( url: 'supabaseUrl', - anonKey: 'supabaseAnonKey', + anonKey: 'supabasePublishableKey', realtimeClientOptions: const RealtimeClientOptions(eventsPerSecond: 40), ); runApp(const MyApp()); diff --git a/examples/realtime/nextjs-auth-presence/README.md b/examples/realtime/nextjs-auth-presence/README.md index e887b8fc03c..2e65b80aaa4 100644 --- a/examples/realtime/nextjs-auth-presence/README.md +++ b/examples/realtime/nextjs-auth-presence/README.md @@ -42,7 +42,7 @@ Create a .env.local file and add following environment variables. ``` NEXT_PUBLIC_SUPABASE_URL=<> -NEXT_PUBLIC_SUPABASE_ANON_KEY=<> +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=<> ``` ### 5. Now run the development server! diff --git a/examples/realtime/nextjs-auth-presence/sample.env.local b/examples/realtime/nextjs-auth-presence/sample.env.local index 87d25650efd..4566514baa3 100644 --- a/examples/realtime/nextjs-auth-presence/sample.env.local +++ b/examples/realtime/nextjs-auth-presence/sample.env.local @@ -1,2 +1,2 @@ NEXT_PUBLIC_SUPABASE_URL="replace-this-with-your-supabase-instance" -NEXT_PUBLIC_SUPABASE_ANON_KEY="replace-this-with-your-supabasedb-anon-key" \ No newline at end of file +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY="replace-this-with-your-supabasedb-anon-key" \ No newline at end of file diff --git a/examples/realtime/nextjs-authorization-demo/.env.example b/examples/realtime/nextjs-authorization-demo/.env.example index c4c451c51a3..7856b65133c 100644 --- a/examples/realtime/nextjs-authorization-demo/.env.example +++ b/examples/realtime/nextjs-authorization-demo/.env.example @@ -1,2 +1,2 @@ NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= diff --git a/examples/realtime/nextjs-authorization-demo/utils/supabase/client.ts b/examples/realtime/nextjs-authorization-demo/utils/supabase/client.ts index e2660d0f654..5bcab1dba35 100644 --- a/examples/realtime/nextjs-authorization-demo/utils/supabase/client.ts +++ b/examples/realtime/nextjs-authorization-demo/utils/supabase/client.ts @@ -3,5 +3,5 @@ import { createBrowserClient } from "@supabase/ssr"; export const createClient = () => createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, ); diff --git a/examples/realtime/nextjs-authorization-demo/utils/supabase/middleware.ts b/examples/realtime/nextjs-authorization-demo/utils/supabase/middleware.ts index 8c6338c8026..66eb55acee4 100644 --- a/examples/realtime/nextjs-authorization-demo/utils/supabase/middleware.ts +++ b/examples/realtime/nextjs-authorization-demo/utils/supabase/middleware.ts @@ -14,7 +14,7 @@ export const updateSession = async (request: NextRequest) => { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { get(name: string) { diff --git a/examples/realtime/nextjs-authorization-demo/utils/supabase/server.ts b/examples/realtime/nextjs-authorization-demo/utils/supabase/server.ts index 0c77d5f6a16..a87560d96bc 100644 --- a/examples/realtime/nextjs-authorization-demo/utils/supabase/server.ts +++ b/examples/realtime/nextjs-authorization-demo/utils/supabase/server.ts @@ -6,7 +6,7 @@ export const createClient = async () => { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { get(name: string) { diff --git a/examples/slack-clone/nextjs-slack-clone-dotenvx/README.md b/examples/slack-clone/nextjs-slack-clone-dotenvx/README.md index 15366afc747..2ef1bc0ad8e 100644 --- a/examples/slack-clone/nextjs-slack-clone-dotenvx/README.md +++ b/examples/slack-clone/nextjs-slack-clone-dotenvx/README.md @@ -122,7 +122,7 @@ Sign up at [Supabase Dashboard](https://supabase.com/dashboard) and create a new ```dotenv NEXT_PUBLIC_SUPABASE_URL=https://.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` 2. **Configure Production Variables:** diff --git a/examples/slack-clone/nextjs-slack-clone-dotenvx/lib/Store.js b/examples/slack-clone/nextjs-slack-clone-dotenvx/lib/Store.js index 545cf55e372..4d1cad97235 100644 --- a/examples/slack-clone/nextjs-slack-clone-dotenvx/lib/Store.js +++ b/examples/slack-clone/nextjs-slack-clone-dotenvx/lib/Store.js @@ -3,7 +3,7 @@ import { createClient } from '@supabase/supabase-js' export const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ) /** diff --git a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env index 4d54da1d33c..1d893ff36c0 100644 --- a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env +++ b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env @@ -2,7 +2,7 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api # URL of supabase api will be passed to next frontend build for app deployment NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 -NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 # The frontend site url, will be used by Supabase Auth services to properly configure auth redirects SUPABASE_AUTH_SITE_URL=http://localhost:3000 SUPABASE_AUTH_ADDITIONAL_REDIRECT_URLS=http://localhost:3000/**,http://localhost:3000/ diff --git a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.preview b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.preview index 8f5e7b7b9d7..329e4ca2805 100644 --- a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.preview +++ b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.preview @@ -2,7 +2,7 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api # URL of supabase api will be passed to next frontend build for app deployment NEXT_PUBLIC_SUPABASE_URL=https://.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= # The frontend site url, will be used by Supabase Auth services to properly configure auth redirects SUPABASE_AUTH_SITE_URL=https://.vercel.app/ SUPABASE_AUTH_ADDITIONAL_REDIRECT_URLS=https://.vercel.app/** diff --git a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.production b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.production index e30e6945d59..7d77a2da51b 100644 --- a/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.production +++ b/examples/slack-clone/nextjs-slack-clone-dotenvx/supabase/.env.production @@ -2,7 +2,7 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api # URL of supabase api will be passed to next frontend build for app deployment NEXT_PUBLIC_SUPABASE_URL=https://.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= # The frontend site url, will be used by Supabase Auth services to properly configure auth redirects SUPABASE_AUTH_SITE_URL=https://.vercel.app/ SUPABASE_AUTH_ADDITIONAL_REDIRECT_URLS=https://.vercel.app/** diff --git a/examples/slack-clone/nextjs-slack-clone/.env.example b/examples/slack-clone/nextjs-slack-clone/.env.example index 3c4800ce3c5..e1a9c27782a 100644 --- a/examples/slack-clone/nextjs-slack-clone/.env.example +++ b/examples/slack-clone/nextjs-slack-clone/.env.example @@ -1,6 +1,6 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321/ -NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 NEXT_SITE_URL=http://localhost:3000 NEXT_REDIRECT_URLS=http://localhost:3000/ diff --git a/examples/slack-clone/nextjs-slack-clone/.env.production.example b/examples/slack-clone/nextjs-slack-clone/.env.production.example index 5696ef25422..ff753ecf743 100644 --- a/examples/slack-clone/nextjs-slack-clone/.env.production.example +++ b/examples/slack-clone/nextjs-slack-clone/.env.production.example @@ -1,6 +1,6 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key # Get this from your Vercel project settings NEXT_SITE_URL=https://..vercel.app/ NEXT_REDIRECT_URLS=https://..vercel.app/,https://..vercel.app/** diff --git a/examples/slack-clone/nextjs-slack-clone/README.md b/examples/slack-clone/nextjs-slack-clone/README.md index f0b378d8d47..ee143e42cdf 100644 --- a/examples/slack-clone/nextjs-slack-clone/README.md +++ b/examples/slack-clone/nextjs-slack-clone/README.md @@ -76,7 +76,7 @@ Supabase integrates seamlessly with Vercel's preview branches, giving each branc 2. Configure the "Preview" environment variables in Vercel: - `NEXT_PUBLIC_SUPABASE_URL` - - `NEXT_PUBLIC_SUPABASE_ANON_KEY` + - `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` 3. Create a new branch, make changes (e.g., update `max_frequency`), and push the branch to Git. - Open a pull request to trigger Vercel + Supabase integration. diff --git a/examples/slack-clone/nextjs-slack-clone/lib/Store.js b/examples/slack-clone/nextjs-slack-clone/lib/Store.js index 545cf55e372..4d1cad97235 100644 --- a/examples/slack-clone/nextjs-slack-clone/lib/Store.js +++ b/examples/slack-clone/nextjs-slack-clone/lib/Store.js @@ -3,7 +3,7 @@ import { createClient } from '@supabase/supabase-js' export const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ) /** diff --git a/examples/storage/resumable-upload-uppy/index.html b/examples/storage/resumable-upload-uppy/index.html index 437a7885819..6683147bc8a 100644 --- a/examples/storage/resumable-upload-uppy/index.html +++ b/examples/storage/resumable-upload-uppy/index.html @@ -44,7 +44,7 @@ Tus, } from 'https://releases.transloadit.com/uppy/v3.6.1/uppy.min.mjs' - const SUPABASE_ANON_KEY = 'replace-with-your-anon-key' + const SUPABASE_ANON_KEY = 'replace-with-your-publishable-key' const SUPABASE_PROJECT_ID = 'replace-with-your-project-id' const STORAGE_BUCKET = 'replace-with-your-bucket-id' const BEARER_TOKEN='replace-with-your-bearer-token' diff --git a/examples/todo-list/nextjs-todo-list/.env.example b/examples/todo-list/nextjs-todo-list/.env.example index ea091e9b1d5..0596c676a28 100644 --- a/examples/todo-list/nextjs-todo-list/.env.example +++ b/examples/todo-list/nextjs-todo-list/.env.example @@ -1,5 +1,5 @@ # Update these with your Supabase details from your project settings > API NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 -NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 NEXT_SITE_URL=http://localhost:3000 NEXT_REDIRECT_URLS=http://localhost:3000/ diff --git a/examples/todo-list/nextjs-todo-list/.env.production.example b/examples/todo-list/nextjs-todo-list/.env.production.example index 05667daec5a..5d4dfec76a6 100644 --- a/examples/todo-list/nextjs-todo-list/.env.production.example +++ b/examples/todo-list/nextjs-todo-list/.env.production.example @@ -1,6 +1,6 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key # Get this from your Vercel project settings NEXT_SITE_URL=https://..vercel.app/ NEXT_REDIRECT_URLS=https://*.vercel.app/,https://*.vercel.app/** diff --git a/examples/todo-list/nextjs-todo-list/README.md b/examples/todo-list/nextjs-todo-list/README.md index 2535f8d9e22..8c76eea1c05 100644 --- a/examples/todo-list/nextjs-todo-list/README.md +++ b/examples/todo-list/nextjs-todo-list/README.md @@ -65,7 +65,7 @@ Supabase integrates seamlessly with Vercel's preview branches, giving each branc 2. Configure the "Preview" environment variables in Vercel: - `NEXT_PUBLIC_SUPABASE_URL` - - `NEXT_PUBLIC_SUPABASE_ANON_KEY` + - `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` 3. Create a new branch, make changes (e.g., update `max_frequency`), and push the branch to Git. - Open a pull request to trigger Vercel + Supabase integration. diff --git a/examples/todo-list/nextjs-todo-list/lib/initSupabase.ts b/examples/todo-list/nextjs-todo-list/lib/initSupabase.ts index 7827f47d5a9..0895fb27dd5 100644 --- a/examples/todo-list/nextjs-todo-list/lib/initSupabase.ts +++ b/examples/todo-list/nextjs-todo-list/lib/initSupabase.ts @@ -2,5 +2,5 @@ import { createClient } from '@supabase/supabase-js' export const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL ?? '', - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? '' + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY ?? '' ) diff --git a/examples/todo-list/sveltejs-todo-list/.env.example b/examples/todo-list/sveltejs-todo-list/.env.example index 12c3cbaafde..e588d442b88 100644 --- a/examples/todo-list/sveltejs-todo-list/.env.example +++ b/examples/todo-list/sveltejs-todo-list/.env.example @@ -1,3 +1,3 @@ # Update these with your Supabase details from your project settings > API VITE_SUPABASE_URL=https://your-project.supabase.co -VITE_SUPABASE_ANON_KEY=your-anon-key \ No newline at end of file +VITE_SUPABASE_ANON_KEY=your-publishable-key \ No newline at end of file diff --git a/examples/user-management/expo-push-notifications/lib/supabase.ts b/examples/user-management/expo-push-notifications/lib/supabase.ts index fba048474b4..52aa997e4ef 100644 --- a/examples/user-management/expo-push-notifications/lib/supabase.ts +++ b/examples/user-management/expo-push-notifications/lib/supabase.ts @@ -3,10 +3,10 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import { createClient } from "@supabase/supabase-js"; const supabaseUrl = "https://bqeuunydbomjvynieund.supabase.co"; -const supabaseAnonKey = +const supabasePublishableKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJxZXV1bnlkYm9tanZ5bmlldW5kIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTgxMTY4NzMsImV4cCI6MjAxMzY5Mjg3M30.K-g-aVqNSutPQ11V68voGkmy3rzel5GkQj6zsBu2V3E"; -export const supabase = createClient(supabaseUrl, supabaseAnonKey, { +export const supabase = createClient(supabaseUrl, supabasePublishableKey, { auth: { storage: AsyncStorage, autoRefreshToken: true, diff --git a/examples/user-management/expo-user-management/.env.example b/examples/user-management/expo-user-management/.env.example index dd6bd19b418..b3860c9c14f 100644 --- a/examples/user-management/expo-user-management/.env.example +++ b/examples/user-management/expo-user-management/.env.example @@ -1,4 +1,4 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api EXPO_PUBLIC_SUPABASE_URL=https://your-project.supabase.co -EXPO_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key diff --git a/examples/user-management/expo-user-management/lib/supabase.ts b/examples/user-management/expo-user-management/lib/supabase.ts index 21e11736060..8109a389b27 100644 --- a/examples/user-management/expo-user-management/lib/supabase.ts +++ b/examples/user-management/expo-user-management/lib/supabase.ts @@ -2,9 +2,9 @@ import { createClient } from '@supabase/supabase-js' import AsyncStorage from '@react-native-async-storage/async-storage' const supabaseUrl = 'https://project.supabase.co' -const supabaseAnonKey = 'your-anon-key' +const supabasePublishableKey = 'your-publishable-key' -export const supabase = createClient(supabaseUrl, supabaseAnonKey, { +export const supabase = createClient(supabaseUrl, supabasePublishableKey, { auth: { storage: AsyncStorage as any, autoRefreshToken: true, diff --git a/examples/user-management/nextjs-user-management/.env.example b/examples/user-management/nextjs-user-management/.env.example index 132444f96dd..a4de36c3e44 100644 --- a/examples/user-management/nextjs-user-management/.env.example +++ b/examples/user-management/nextjs-user-management/.env.example @@ -1,5 +1,5 @@ # Thoses are the default development values NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321/ -NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 NEXT_SITE_URL=http://localhost:3000 NEXT_REDIRECT_URLS=http://localhost:3000/ diff --git a/examples/user-management/nextjs-user-management/.env.production.example b/examples/user-management/nextjs-user-management/.env.production.example index 5696ef25422..ff753ecf743 100644 --- a/examples/user-management/nextjs-user-management/.env.production.example +++ b/examples/user-management/nextjs-user-management/.env.production.example @@ -1,6 +1,6 @@ # Get these from your API settings: https://supabase.com/dashboard/project/_/settings/api NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co -NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key # Get this from your Vercel project settings NEXT_SITE_URL=https://..vercel.app/ NEXT_REDIRECT_URLS=https://..vercel.app/,https://..vercel.app/** diff --git a/examples/user-management/nextjs-user-management/README.md b/examples/user-management/nextjs-user-management/README.md index 1ad490b39d8..49e2dd72d3f 100644 --- a/examples/user-management/nextjs-user-management/README.md +++ b/examples/user-management/nextjs-user-management/README.md @@ -79,7 +79,7 @@ Supabase integrates seamlessly with Vercel's preview branches, giving each branc 2. Configure the "Preview" environment variables in Vercel: - `NEXT_PUBLIC_SUPABASE_URL` - - `NEXT_PUBLIC_SUPABASE_ANON_KEY` + - `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` 3. Create a new branch, make changes (e.g., update `max_frequency`), and push the branch to Git. - Open a pull request to trigger Vercel + Supabase integration. diff --git a/examples/user-management/nextjs-user-management/utils/supabase/client.ts b/examples/user-management/nextjs-user-management/utils/supabase/client.ts index 5084e61059e..30f697a3a5e 100644 --- a/examples/user-management/nextjs-user-management/utils/supabase/client.ts +++ b/examples/user-management/nextjs-user-management/utils/supabase/client.ts @@ -4,6 +4,6 @@ export function createClient() { // Create a supabase client on the browser with project's credentials return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ); } diff --git a/examples/user-management/nextjs-user-management/utils/supabase/middleware.ts b/examples/user-management/nextjs-user-management/utils/supabase/middleware.ts index d3a19ebbe87..13e79154c16 100644 --- a/examples/user-management/nextjs-user-management/utils/supabase/middleware.ts +++ b/examples/user-management/nextjs-user-management/utils/supabase/middleware.ts @@ -8,7 +8,7 @@ export async function updateSession(request: NextRequest) { const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/examples/user-management/nextjs-user-management/utils/supabase/server.ts b/examples/user-management/nextjs-user-management/utils/supabase/server.ts index 8d2814a52a4..5b32e5b571e 100644 --- a/examples/user-management/nextjs-user-management/utils/supabase/server.ts +++ b/examples/user-management/nextjs-user-management/utils/supabase/server.ts @@ -8,7 +8,7 @@ export async function createClient() { // which could be used to maintain user's session return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/examples/user-management/react-user-management/src/supabaseClient.js b/examples/user-management/react-user-management/src/supabaseClient.js index 3ad7e698fe6..8a2f9e16ae4 100644 --- a/examples/user-management/react-user-management/src/supabaseClient.js +++ b/examples/user-management/react-user-management/src/supabaseClient.js @@ -6,6 +6,6 @@ import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabasePublishableKey = import.meta.env.VITE_SUPABASE_ANON_KEY -export const supabase = createClient(supabaseUrl, supabaseAnonKey) +export const supabase = createClient(supabaseUrl, supabasePublishableKey) diff --git a/examples/user-management/refine-user-management/src/utility/supabaseClient.ts b/examples/user-management/refine-user-management/src/utility/supabaseClient.ts index d58cb40f1e4..edca3c3e810 100644 --- a/examples/user-management/refine-user-management/src/utility/supabaseClient.ts +++ b/examples/user-management/refine-user-management/src/utility/supabaseClient.ts @@ -2,9 +2,9 @@ import { createClient } from "@refinedev/supabase"; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; +const supabasePublishableKey = import.meta.env.VITE_SUPABASE_ANON_KEY; -export const supabaseClient = createClient(supabaseUrl, supabaseAnonKey, { +export const supabaseClient = createClient(supabaseUrl, supabasePublishableKey, { db: { schema: "public", }, diff --git a/examples/user-management/solid-user-management/.env.example b/examples/user-management/solid-user-management/.env.example index 62e54e9d805..f80575a5c66 100644 --- a/examples/user-management/solid-user-management/.env.example +++ b/examples/user-management/solid-user-management/.env.example @@ -1,2 +1,2 @@ VITE_SUPABASE_URL=https://your-project-ref.supabase.co -VITE_SUPABASE_ANON_KEY=your-anon-key \ No newline at end of file +VITE_SUPABASE_ANON_KEY=your-publishable-key \ No newline at end of file diff --git a/examples/user-management/solid-user-management/src/supabaseClient.tsx b/examples/user-management/solid-user-management/src/supabaseClient.tsx index ec271d13058..5e65dd8a39d 100644 --- a/examples/user-management/solid-user-management/src/supabaseClient.tsx +++ b/examples/user-management/solid-user-management/src/supabaseClient.tsx @@ -2,6 +2,6 @@ import { createClient } from '@supabase/supabase-js' import { Database } from './schema' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabasePublishableKey = import.meta.env.VITE_SUPABASE_ANON_KEY -export const supabase = createClient(supabaseUrl, supabaseAnonKey) +export const supabase = createClient(supabaseUrl, supabasePublishableKey) diff --git a/examples/user-management/svelte-user-management/.env.example b/examples/user-management/svelte-user-management/.env.example index 62e54e9d805..f80575a5c66 100644 --- a/examples/user-management/svelte-user-management/.env.example +++ b/examples/user-management/svelte-user-management/.env.example @@ -1,2 +1,2 @@ VITE_SUPABASE_URL=https://your-project-ref.supabase.co -VITE_SUPABASE_ANON_KEY=your-anon-key \ No newline at end of file +VITE_SUPABASE_ANON_KEY=your-publishable-key \ No newline at end of file diff --git a/examples/user-management/svelte-user-management/src/supabaseClient.ts b/examples/user-management/svelte-user-management/src/supabaseClient.ts index 89f1679a796..8d29584a1ec 100644 --- a/examples/user-management/svelte-user-management/src/supabaseClient.ts +++ b/examples/user-management/svelte-user-management/src/supabaseClient.ts @@ -1,6 +1,6 @@ import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabasePublishableKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY -export const supabase = createClient(supabaseUrl, supabaseAnonKey) \ No newline at end of file +export const supabase = createClient(supabaseUrl, supabasePublishableKey) \ No newline at end of file diff --git a/examples/user-management/sveltekit-user-management/.env.example b/examples/user-management/sveltekit-user-management/.env.example index e9e30a5295b..b3ec27d3228 100644 --- a/examples/user-management/sveltekit-user-management/.env.example +++ b/examples/user-management/sveltekit-user-management/.env.example @@ -1,3 +1,3 @@ # Update these with your Supabase details from your project settings > API PUBLIC_SUPABASE_URL=https://your-project.supabase.co -PUBLIC_SUPABASE_ANON_KEY=your-anon-key \ No newline at end of file +PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key \ No newline at end of file diff --git a/examples/user-management/sveltekit-user-management/src/hooks.server.ts b/examples/user-management/sveltekit-user-management/src/hooks.server.ts index 41974b23ddb..4da88ef59bf 100644 --- a/examples/user-management/sveltekit-user-management/src/hooks.server.ts +++ b/examples/user-management/sveltekit-user-management/src/hooks.server.ts @@ -1,10 +1,10 @@ // src/hooks.server.ts -import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public' +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public' import { createServerClient } from '@supabase/ssr' import type { Handle } from '@sveltejs/kit' export const handle: Handle = async ({ event, resolve }) => { - event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: { getAll: () => event.cookies.getAll(), /** diff --git a/examples/user-management/sveltekit-user-management/src/routes/+layout.ts b/examples/user-management/sveltekit-user-management/src/routes/+layout.ts index 26d08b82b2d..0886b269ec2 100644 --- a/examples/user-management/sveltekit-user-management/src/routes/+layout.ts +++ b/examples/user-management/sveltekit-user-management/src/routes/+layout.ts @@ -1,5 +1,5 @@ // src/routes/+layout.ts -import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' +import { PUBLIC_SUPABASE_PUBLISHABLE_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public' import type { LayoutLoad } from './$types' import { createBrowserClient, createServerClient, isBrowser } from '@supabase/ssr' @@ -7,12 +7,12 @@ export const load: LayoutLoad = async ({ fetch, data, depends }) => { depends('supabase:auth') const supabase = isBrowser() - ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + ? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, }) - : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { + : createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, { global: { fetch, }, diff --git a/examples/user-management/vue3-user-management/.env.example b/examples/user-management/vue3-user-management/.env.example index 62e54e9d805..f80575a5c66 100644 --- a/examples/user-management/vue3-user-management/.env.example +++ b/examples/user-management/vue3-user-management/.env.example @@ -1,2 +1,2 @@ VITE_SUPABASE_URL=https://your-project-ref.supabase.co -VITE_SUPABASE_ANON_KEY=your-anon-key \ No newline at end of file +VITE_SUPABASE_ANON_KEY=your-publishable-key \ No newline at end of file diff --git a/examples/user-management/vue3-user-management/src/supabase.js b/examples/user-management/vue3-user-management/src/supabase.js index aac95ff8adc..eb3352a2403 100644 --- a/examples/user-management/vue3-user-management/src/supabase.js +++ b/examples/user-management/vue3-user-management/src/supabase.js @@ -1,6 +1,6 @@ import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITE_SUPABASE_URL -const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY +const supabasePublishableKey = import.meta.env.VITE_SUPABASE_ANON_KEY -export const supabase = createClient(supabaseUrl, supabaseAnonKey) +export const supabase = createClient(supabaseUrl, supabasePublishableKey)