diff --git a/apps/docs/content/_partials/oauth_pkce_flow.mdx b/apps/docs/content/_partials/oauth_pkce_flow.mdx index c98eacb633..f1035c0893 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 47d201dccf..dc0d3b8fc7 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 e9cfbe80ea..094f4b25a4 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 64c4488402..6ef1b30c0d 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 7c5b6d288e..d74f2ce603 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 929fd31123..5f9fe4770d 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 0a4f0b43c2..30b6af5859 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 bda140dfe5..8f23b52a28 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 73507acfc7..c0e25cb4fd 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 9af561e396..7e276930bb 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 547cdfc1ee..af8e4bf0bd 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 da1299d328..629d75f67b 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 25d9724d26..c518caeba9 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 9a67c33cc9..719528aa2e 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 56bae4f8f1..77144658e1 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 a20b58a6cb..cc98b5825f 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 961f4cc4c7..218d675e6d 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 69e6a29ef4..488d11d1ed 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 45d125f907..71a0a669a1 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 04b1d087a7..af12c47789 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 7e8a38450e..08e8649f1d 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 0443da1725..ca43981674 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 f8b0719df4..81db989fa9 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 6cded62c57..b83940ccba 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 92a4cb5fc8..e05585ea98 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 fb7afec649..66cbd826f1 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 0751f22c12..98d33c6856 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 1057da8f83..c9176e917e 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 50b1be0015..24eb3432ac 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 18992be42c..927854fdef 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 b8f17ff2bd..f6a0d5538c 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 9b3701f9a9..6fd11bdc0c 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 49dcbe799c..2953ad223a 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 186759e0a9..56df4e93f7 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 59f7a78021..be691bad7f 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 29dbceb668..950c50f67b 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 48d0598698..73ec7c240a 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 251b54e22b..8a04410f56 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 d51dc093b0..4b3b115b9d 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 25593c498a..e1715289ba 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 c160594c60..6c74d83480 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 dbb3b4458b..ad356b654a 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 f1ed101fbc..b78996ceba 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 ecd807b852..a41f9df64d 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 4c961dec1d..71bbe5d6f9 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 097dd6cabe..76cf04be64 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 183d5f8f6e..d2ced1133a 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 852eb4dedc..f860db26d1 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 6cc9b93f21..438141cd5a 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 341a4b75f4..3edbf1d9d9 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 ca91575b35..7e8959a636 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 4a046611bd..2422a3a716 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 41fa14063c..f8dcbfaa92 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 0ce71d267d..5183045193 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 254a37dad9..bef637ca04 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 64bd322300..5a7a5ff431 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 5986ad3087..75f862ee9a 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 ec4e0efc14..6420a59f13 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 6e24572538..91f73e5616 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 14690e27cc..70277ee447 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 bfc6a12f4c..cad739e7e8 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 50a5722cd6..af74baf522 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 88fb3063b5..0646a93b22 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 032663d43f..f71f5bda2b 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 83b5b62d95..f98c7b3556 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 dea1fad9bd..b5475206e6 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 6b19272384..a3c5623cb4 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 6d82cab6ac..abc9e995e4 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 3499a0a2e2..382904c84a 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 9a54445e2f..25dc9824ff 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 0d060dda2e..9c2ea9a6a3 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 20e45f4e4a..465d7cb35f 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 f108915516..671db76c40 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 1c01d3c81e..79d9281493 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 2d8812515b..2d8a4b3214 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 08cb3e10ff..e302ac40f9 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 59de68988c..4acba3e54d 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 43def489bf..27c9528c01 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 1705ea759e..29764e5966 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 f522688580..a5a5366964 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 5821eeccb0..0f753e5d20 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 0d00899b51..ddc5030f78 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 32226013bb..e4d4a5e884 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 fb544f58e5..b81e65da6d 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 b4fbda80fa..558cd8ba9e 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 3cdf5b5a1d..993b6935fd 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 f545643cb2..2c599015f0 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 18073b40cd..d27742ef11 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 e3ede25bc2..0c324a7d9e 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 e58342d068..a7d3326c00 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 82e4ab3e1c..be74eaaf1e 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 a8bbb49e0a..2c2eebb5b6 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 6eb80d4b26..dcaf090330 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 b8e67c1b51..a1f80811d3 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 1f3efc262e..0419f3a506 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 f6a4988ea7..ad95a7eb62 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 f8d4b851d7..56e98c2688 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 64c83d7333..9abe0018f8 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 24d2888a07..d9f3490500 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 693703197a..5f69cea9e2 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 7bce067f99..88893a38db 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 06848736b2..cb5f10d613 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 237cdc0cbd..ce48362634 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 40633b0c5b..aed1ce1830 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 ebd83d9fe3..d8eda636b9 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 03729d0b48..b2fcc8a37e 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 2919434932..9d02e8e3e8 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 7fc4012f1e..4d80fd6dbb 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 a75ab5ca9c..4222878455 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 5c796d58e8..8b7a689310 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 2dfefd2056..81f44778d1 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 0c1b7fcd49..fa03525a06 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 9dbeb5b151..cdfdb13c40 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 e887b8fc03..2e65b80aaa 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 87d25650ef..4566514baa 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 c4c451c51a..7856b65133 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 e2660d0f65..5bcab1dba3 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 8c6338c802..66eb55acee 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 0c77d5f6a1..a87560d96b 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 15366afc74..2ef1bc0ad8 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 545cf55e37..4d1cad9723 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 4d54da1d33..1d893ff36c 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 8f5e7b7b9d..329e4ca280 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 e30e6945d5..7d77a2da51 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 3c4800ce3c..e1a9c27782 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 5696ef2542..ff753ecf74 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 f0b378d8d4..ee143e42cd 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 545cf55e37..4d1cad9723 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 437a788581..6683147bc8 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 ea091e9b1d..0596c676a2 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 05667daec5..5d4dfec76a 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 2535f8d9e2..8c76eea1c0 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 7827f47d5a..0895fb27dd 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 12c3cbaafd..e588d442b8 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 fba048474b..52aa997e4e 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 dd6bd19b41..b3860c9c14 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 21e1173606..8109a389b2 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 132444f96d..a4de36c3e4 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 5696ef2542..ff753ecf74 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 1ad490b39d..49e2dd72d3 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 5084e61059..30f697a3a5 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 d3a19ebbe8..13e79154c1 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 8d2814a52a..5b32e5b571 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 3ad7e698fe..8a2f9e16ae 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 d58cb40f1e..edca3c3e81 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 62e54e9d80..f80575a5c6 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 ec271d1305..5e65dd8a39 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 62e54e9d80..f80575a5c6 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 89f1679a79..8d29584a1e 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 e9e30a5295..b3ec27d322 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 41974b23dd..4da88ef59b 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 26d08b82b2..0886b269ec 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 62e54e9d80..f80575a5c6 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 aac95ff8ad..eb3352a240 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)