diff --git a/apps/docs/content/_partials/oauth_pkce_flow.mdx b/apps/docs/content/_partials/oauth_pkce_flow.mdx index c98eacb63364e..f1035c0893708 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') ?? '') - }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) + 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)) + ) + }, }, - }, - }) + } + ) 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 47d201dccf4d3..dc0d3b8fc7480 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 e9cfbe80eaf40..094f4b25a4096 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 64c44884024b9..6ef1b30c0dfaf 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 7c5b6d288e90c..d74f2ce603b00 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 929fd31123b66..5f9fe4770d5ee 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 0a4f0b43c2e15..30b6af585925f 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 bda140dfe5924..8f23b52a28414 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 73507acfc71e0..c0e25cb4fd099 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 9af561e396d7d..7e276930bb80d 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 547cdfc1ee693..af8e4bf0bd22c 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 da1299d328a03..629d75f67b07e 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 25d9724d26292..c518caeba91cb 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 9a67c33cc972d..719528aa2e284 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 56bae4f8f16b9..77144658e1237 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 a20b58a6cb1cf..cc98b5825f244 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 961f4cc4c73cf..218d675e6da4b 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') ?? '') - }, - setAll(key, value, options) { - headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) + 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)) + }, }, - }, - }) + } + ) 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') ?? '') - }, - setAll(key, value, options) { - headers.append('Set-Cookie', serializeCookieHeader(key, value, options)) + 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)) + }, }, - }, - }) + } + ) 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 69e6a29ef4435..488d11d1ed840 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 45d125f907436..71a0a669a19b9 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 04b1d087a784f..af12c47789dfa 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 7e8a38450e911..08e8649f1d433 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') ?? '') - }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) + 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)) + ) + }, }, - }, - }) + } + ) 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') ?? '') - }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => - headers.append('Set-Cookie', serializeCookieHeader(name, value, options)) - ) + 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)) + ) + }, }, - }, - }) + } + ) 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 0443da172579b..ca43981674c78 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 f8b0719df4b2c..81db989fa9ecc 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 6cded62c576d4..b83940ccba2d8 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 92a4cb5fc8e25..e05585ea9874a 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 fb7afec649f79..66cbd826f1148 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 0751f22c12eb3..98d33c6856c75 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 1057da8f83100..c9176e917ee4a 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 50b1be00155c8..24eb3432ac0d9 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 18992be42c094..927854fdef292 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 b8f17ff2bd59f..f6a0d5538cb56 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 9b3701f9a9cbd..6fd11bdc0c9d2 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 49dcbe799c61d..2953ad223a83d 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 186759e0a9ad2..56df4e93f7278 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 59f7a78021516..be691bad7f72c 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 29dbceb668ec9..950c50f67bb67 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 48d0598698ea4..73ec7c240af2d 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 251b54e22ba3b..8a04410f56376 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 d51dc093b0660..4b3b115b9dca2 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 25593c498aada..e1715289ba5cd 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 c160594c60db3..6c74d83480c0d 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 dbb3b4458bfe1..ad356b654aff6 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 f1ed101fbc1fd..b78996ceba325 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 ecd807b8528c7..a41f9df64d451 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 4c961dec1d1f0..71bbe5d6f96f5 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 097dd6cabe9cf..76cf04be6437f 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 183d5f8f6e6ea..d2ced1133a804 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() - - // Alternatively you can use tokens?.idToken instead. - return tokens?.accessToken - }, -}) +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 + }, + } +) // 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 852eb4dedc206..f860db26d15cd 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 6cc9b93f214a9..438141cd5a0ef 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 341a4b75f485c..3edbf1d9d92e2 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 ca91575b35ca0..7e8959a6368e6 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 4a046611bdfda..2422a3a7169bf 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 41fa14063cd6b..f8dcbfaa92b7b 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 0ce71d267db63..5183045193d39 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 254a37dad9209..bef637ca04e39 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 64bd322300740..5a7a5ff431ac3 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 5986ad3087b26..75f862ee9a6c0 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 ec4e0efc14af0..6420a59f1390e 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 6e245725384fc..91f73e5616ac3 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 14690e27cc3b5..70277ee447ef3 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 bfc6a12f4ccac..cad739e7e8624 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 50a5722cd6544..af74baf522eb5 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 88fb3063b58e2..0646a93b22ad8 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 032663d43fbe1..f71f5bda2b84b 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 83b5b62d9590c..f98c7b3556252 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 dea1fad9bd9ff..b5475206e644d 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 6b19272384be8..a3c5623cb495d 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 6d82cab6ac85b..abc9e995e4381 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 3499a0a2e2792..382904c84a2e6 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 9a54445e2fb75..25dc9824ffd1f 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 0d060dda2e610..9c2ea9a6a388e 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 20e45f4e4a7e1..465d7cb35f95f 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 f10891551651b..671db76c40634 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 1c01d3c81e3a2..79d928149342c 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 2d8812515b193..2d8a4b3214dca 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 08cb3e10fff95..e302ac40f9118 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 59de68988c966..4acba3e54d5f3 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 43def489bf8d5..27c9528c014f6 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 1705ea759e4f0..29764e59660a7 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 f522688580788..a5a5366964668 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 5821eeccb07c8..0f753e5d2089f 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 0d00899b5103c..ddc5030f78140 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 32226013bb82e..e4d4a5e88471f 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 fb544f58e5f35..b81e65da6d4b2 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 b4fbda80fa592..558cd8ba9eb06 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 3cdf5b5a1d686..993b6935fd651 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 f545643cb2dd9..2c599015f088b 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 18073b40cd74d..d27742ef11a80 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 e3ede25bc25a6..0c324a7d9e602 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/public/humans.txt b/apps/docs/public/humans.txt index bcfefdf753377..5e60cfc984c90 100644 --- a/apps/docs/public/humans.txt +++ b/apps/docs/public/humans.txt @@ -18,6 +18,7 @@ Bo Lu Bobbie Soedirgo Brent Newson Carel de Waal +Cameron Blackwood Cemal Kılıç Chandana Anumula Charis Lam diff --git a/apps/docs/spec/supabase_dart_v1.yml b/apps/docs/spec/supabase_dart_v1.yml index e58342d068d48..a7d3326c0000b 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 82e4ab3e1ce7c..be74eaaf1ee66 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 a8bbb49e0abe1..2c2eebb5b63b4 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 6eb80d4b26233..dcaf090330929 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 b8e67c1b51dc3..a1f80811d365a 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 1f3efc262e141..0419f3a506bb2 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 f6a4988ea7216..ad95a7eb62a40 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 f8d4b851d78e9..56e98c2688afb 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 64c83d73331a6..9abe0018f89a1 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/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx index 34f4c0085f224..d5676bced4958 100644 --- a/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx +++ b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx @@ -11,12 +11,6 @@ import { z } from 'zod' import { useParams } from 'common' import { DocsButton } from 'components/ui/DocsButton' import { FormActions } from 'components/ui/Forms/FormActions' -import { - FormPanelContainer, - FormPanelContent, - FormPanelFooter, - FormPanelHeader, -} from 'components/ui/Forms/FormPanel' import { useProjectPostgrestConfigQuery } from 'data/config/project-postgrest-config-query' import { useProjectPostgrestConfigUpdateMutation } from 'data/config/project-postgrest-config-update-mutation' import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query' @@ -28,6 +22,10 @@ import { AlertTitle_Shadcn_, Alert_Shadcn_, Button, + Card, + CardContent, + CardFooter, + CardHeader, CollapsibleContent_Shadcn_, Collapsible_Shadcn_, FormControl_Shadcn_, @@ -39,7 +37,9 @@ import { Skeleton, Switch, WarningIcon, + cn, } from 'ui' +import { GenericSkeletonLoader } from 'ui-patterns' import { Admonition } from 'ui-patterns/admonition' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { @@ -83,7 +83,7 @@ export const PostgrestConfig = () => { const [showModal, setShowModal] = useState(false) - const { data: config, isError } = useProjectPostgrestConfigQuery({ projectRef }) + const { data: config, isError, isLoading } = useProjectPostgrestConfigQuery({ projectRef }) const { data: extensions } = useDatabaseExtensionsQuery({ projectRef: project?.ref, connectionString: project?.connectionString, @@ -101,10 +101,8 @@ export const PostgrestConfig = () => { const formId = 'project-postgres-config' const hiddenSchema = ['auth', 'pgbouncer', 'hooks', 'extensions'] - const { can: canUpdatePostgrestConfig } = useAsyncCheckProjectPermissions( - PermissionAction.UPDATE, - 'custom_config_postgrest' - ) + const { can: canUpdatePostgrestConfig, isSuccess: isPermissionsLoaded } = + useAsyncCheckProjectPermissions(PermissionAction.UPDATE, 'custom_config_postgrest') const isGraphqlExtensionEnabled = (extensions ?? []).find((ext) => ext.name === 'pg_graphql')?.installed_version !== null @@ -168,275 +166,274 @@ export const PostgrestConfig = () => { const isDataApiEnabledInForm = form.getValues('enableDataApi') return ( - <> - -
- - - Data API Settings -
- - -
-
- - {isError ? ( - - ) : ( - <> - ( - - - - { - field.onChange(value) - if (!value) { - form.setValue('enableDataApi', false) - form.setValue('dbSchema', []) - } else { - form.setValue('enableDataApi', true) - form.setValue('dbSchema', dbSchema) - } - }} - /> - - + + + Data API Settings +
+ + +
+
+ + + + {isLoading ? ( + + ) : isError ? ( + + ) : ( + <> + ( + + + + { + field.onChange(value) + if (!value) { + form.setValue('enableDataApi', false) + form.setValue('dbSchema', []) + } else { + form.setValue('enableDataApi', true) + form.setValue('dbSchema', dbSchema) + } + }} + /> + + - {!field.value && ( - <> - - - - - No schemas can be queried - - -

- With this setting disabled, you will not be able to query any - schemas via the Data API. -

-

- You will see errors from the Postgrest endpoint - /rest/v1/. -

-
-
- - )} -
- )} - /> - - - ( - - + + + No schemas can be queried + + +

+ With this setting disabled, you will not be able to query any + schemas via the Data API. +

+

+ You will see errors from the Postgrest endpoint + /rest/v1/. +

+
+ + + )} +
+ )} + /> + + + ( + + - {isLoadingSchemas ? ( -
- -
- ) : ( - - - - - {schema.length <= 0 ? ( - - no - - ) : ( - <> - {schema.map((x) => ( - - {x.name} - - ))} - - )} - - - - )} - - {!field.value.includes('public') && field.value.length > 0 && ( - -

- You will not be able to query tables and views in the{' '} - public schema via supabase-js or HTTP clients. -

- {isGraphqlExtensionEnabled && ( - <> -

- Tables in the public{' '} - schema are still exposed over our GraphQL endpoints. -

- - - )} - - } + layout="horizontal" + className="px-8 py-8" + > + {isLoadingSchemas ? ( +
+ +
+ ) : ( + + - )} -
-
- )} - /> + + + {schema.length <= 0 ? ( + + no + + ) : ( + <> + {schema.map((x) => ( + + {x.name} + + ))} + + )} + + + + )} - ( - - - - - - - - )} - /> + {!field.value.includes('public') && field.value.length > 0 && ( + +

+ You will not be able to query tables and views in the{' '} + public schema via supabase-js + or HTTP clients. +

+ {isGraphqlExtensionEnabled && ( + <> +

+ Tables in the public{' '} + schema are still exposed over our GraphQL endpoints. +

+ + + )} + + } + /> + )} + +
+ )} + /> - ( - - - - - - - - )} - /> + ( + + + + + + + + )} + /> - ( - - - - - field.onChange( - e.target.value === '' ? null : Number(e.target.value) - ) - } - value={field.value === null ? '' : field.value} - /> - - - - )} - /> - - - - )} - - - -
-
-
-
+ ( + + + + + + + + )} + /> + + ( + + + + + field.onChange( + e.target.value === '' ? null : Number(e.target.value) + ) + } + value={field.value === null ? '' : field.value} + /> + + + + )} + /> + + + + )} + + + + + + setShowModal(false)} /> - + ) } diff --git a/apps/studio/components/interfaces/Settings/API/ServiceList.tsx b/apps/studio/components/interfaces/Settings/API/ServiceList.tsx index a12eb57794c17..34145807e9320 100644 --- a/apps/studio/components/interfaces/Settings/API/ServiceList.tsx +++ b/apps/studio/components/interfaces/Settings/API/ServiceList.tsx @@ -1,8 +1,8 @@ import { AlertCircle } from 'lucide-react' import { useParams } from 'common' +import { ScaffoldSection } from 'components/layouts/Scaffold' import DatabaseSelector from 'components/ui/DatabaseSelector' -import Panel from 'components/ui/Panel' import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query' import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query' @@ -10,16 +10,22 @@ import { useReadReplicasQuery } from 'data/read-replicas/replicas-query' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' import { useDatabaseSelectorStateSnapshot } from 'state/database-selector' -import { Badge, Input } from 'ui' +import { Alert_Shadcn_, AlertTitle_Shadcn_, Badge, Card, CardContent, CardHeader } from 'ui' +import { Input } from 'ui-patterns/DataInputs/Input' +import { FormLayout } from 'ui-patterns/form/Layout/FormLayout' import { PostgrestConfig } from './PostgrestConfig' -const ServiceList = () => { +export const ServiceList = () => { const { data: project, isLoading } = useSelectedProjectQuery() const { ref: projectRef } = useParams() const state = useDatabaseSelectorStateSnapshot() const { data: customDomainData } = useCustomDomainsQuery({ projectRef }) - const { data: databases, isError } = useReadReplicasQuery({ projectRef }) + const { + data: databases, + isError, + isLoading: isLoadingDatabases, + } = useReadReplicasQuery({ projectRef }) const { data: loadBalancers } = useLoadBalancersQuery({ projectRef }) // Get the API service @@ -36,77 +42,65 @@ const ServiceList = () => { : selectedDatabase?.restUrl return ( -
- {isLoading ? ( - - ) : project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY ? ( -
+ + {!isLoading && project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY ? ( + -

+ API settings are unavailable as the project is not active -

-
+ + ) : ( <> -
- -
Project URL
- 0 - ? [{ id: 'load-balancer', name: 'API Load Balancer' }] - : [] - } - /> -
- } - > - - {isError ? ( -
- -

Failed to retrieve project URL

-
- ) : ( - -

URL

- Custom domain active - - ) : ( - 'URL' - ) - } - readOnly - disabled - className="input-mono" - value={endpoint} - descriptionText={ - loadBalancerSelected - ? 'RESTful endpoint for querying and managing your databases through your load balancer' - : replicaSelected - ? 'RESTful endpoint for querying your read replica' - : 'RESTful endpoint for querying and managing your database' - } - layout="horizontal" - /> - )} -
- - + + + Project URL + 0 + ? [{ id: 'load-balancer', name: 'API Load Balancer' }] + : [] + } + /> + + + {isLoading || isLoadingDatabases ? ( + + ) : isError ? ( + + + Failed to retrieve project URL + + ) : ( + +

URL

+ Custom domain active + + ) : ( + 'URL' + ) + } + description={ + loadBalancerSelected + ? 'RESTful endpoint for querying and managing your databases through your load balancer' + : replicaSelected + ? 'RESTful endpoint for querying your read replica' + : 'RESTful endpoint for querying and managing your database' + } + > + +
+ )} +
+
-
- -
+ )} - + ) } - -export default ServiceList diff --git a/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx index 78d4d7d0ff061..94b1230f34c72 100644 --- a/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx +++ b/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx @@ -18,6 +18,7 @@ import { ScaffoldSectionDetail, } from 'components/layouts/Scaffold' import NoPermission from 'components/ui/NoPermission' +import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only' import { useIntegrationsVercelInstalledConnectionDeleteMutation } from 'data/integrations/integrations-vercel-installed-connection-delete-mutation' import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query' @@ -25,14 +26,13 @@ import type { IntegrationName, IntegrationProjectConnection, } from 'data/integrations/integrations.types' -import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions' +import { useCheckPermissions } from 'hooks/misc/useCheckPermissions' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { pluralize } from 'lib/helpers' import { getIntegrationConfigurationUrl } from 'lib/integration-utils' import { useSidePanelsStateSnapshot } from 'state/side-panels' import { Button, cn } from 'ui' -import { GenericSkeletonLoader } from 'ui-patterns' import { IntegrationImageHandler } from '../IntegrationsSettings' import VercelIntegrationConnectionForm from './VercelIntegrationConnectionForm' @@ -43,13 +43,18 @@ const VercelSection = ({ isProjectScoped }: { isProjectScoped: boolean }) => { const sidePanelsStateSnapshot = useSidePanelsStateSnapshot() const isBranch = project?.parent_project_ref !== undefined - const { can: canReadVercelConnection, isLoading: isLoadingPermissions } = - useAsyncCheckProjectPermissions(PermissionAction.READ, 'integrations.vercel_connections') - const { can: canCreateVercelConnection } = useAsyncCheckProjectPermissions( + // placeholder for isLoading state when a useAsyncCheckOrgPermissions hook is added + // This component in used both in /org/[slug]/integrations and /project/[slug]/settings/integrations + const isLoadingPermissions = false + const canReadVercelConnection = useCheckPermissions( + PermissionAction.READ, + 'integrations.vercel_connections' + ) + const canCreateVercelConnection = useCheckPermissions( PermissionAction.CREATE, 'integrations.vercel_connections' ) - const { can: canUpdateVercelConnection } = useAsyncCheckProjectPermissions( + const canUpdateVercelConnection = useCheckPermissions( PermissionAction.UPDATE, 'integrations.vercel_connections' ) diff --git a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx index 83e3e51a1ac70..d315326a6baae 100644 --- a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx +++ b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx @@ -115,11 +115,6 @@ export function LogsSidebarMenuV2() { const { plan: orgPlan, isLoading: isOrgPlanLoading } = useCurrentOrgPlan() const isFreePlan = !isOrgPlanLoading && orgPlan?.id === 'free' - const isUnifiedLogsPreviewAvailable = - unifiedLogsFlagEnabled && - !isOrgPlanLoading && - ['team', 'enterprise'].includes(orgPlan?.id ?? '') - const { data: savedQueriesRes, isLoading: savedQueriesLoading } = useContentQuery({ projectRef: ref, type: 'log_sql', @@ -234,7 +229,7 @@ export function LogsSidebarMenuV2() { return (
- {IS_PLATFORM && !isUnifiedLogsPreviewAvailable && ( + {IS_PLATFORM && !unifiedLogsFlagEnabled && ( Coming soon} @@ -249,7 +244,7 @@ export function LogsSidebarMenuV2() { } /> )} - {isUnifiedLogsPreviewAvailable && ( + {unifiedLogsFlagEnabled && ( )} diff --git a/apps/studio/pages/project/[ref]/index.tsx b/apps/studio/pages/project/[ref]/index.tsx index a61590463f709..c8ca8cfcce993 100644 --- a/apps/studio/pages/project/[ref]/index.tsx +++ b/apps/studio/pages/project/[ref]/index.tsx @@ -112,7 +112,7 @@ const Home: NextPageWithLayout = () => { const replicasCount = Math.max(0, (replicasData?.length ?? 1) - 1) return ( -
+
diff --git a/apps/studio/pages/project/[ref]/settings/api.tsx b/apps/studio/pages/project/[ref]/settings/api.tsx index 2b0ad1b5c194d..2914082b6a74d 100644 --- a/apps/studio/pages/project/[ref]/settings/api.tsx +++ b/apps/studio/pages/project/[ref]/settings/api.tsx @@ -1,27 +1,23 @@ -import ServiceList from 'components/interfaces/Settings/API/ServiceList' +import { ServiceList } from 'components/interfaces/Settings/API/ServiceList' import DefaultLayout from 'components/layouts/DefaultLayout' +import { PageLayout } from 'components/layouts/PageLayout/PageLayout' import SettingsLayout from 'components/layouts/ProjectSettingsLayout/SettingsLayout' -import { ScaffoldContainer, ScaffoldHeader, ScaffoldTitle } from 'components/layouts/Scaffold' +import { ScaffoldContainer } from 'components/layouts/Scaffold' import type { NextPageWithLayout } from 'types' const ApiSettings: NextPageWithLayout = () => { return ( - <> - - - API Settings - - - - - - + + + ) } ApiSettings.getLayout = (page) => ( - {page} + + {page} + ) export default ApiSettings diff --git a/examples/auth/hono/src/middleware/auth.middleware.ts b/examples/auth/hono/src/middleware/auth.middleware.ts index 24d2888a071f3..d9f34905000a9 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 693703197a72b..5f69cea9e2d29 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 7bce067f99af2..88893a38db6e0 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 06848736b2bf4..cb5f10d6134ef 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 237cdc0cbd7bd..ce48362634e88 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 40633b0c5b85c..aed1ce1830eb9 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 ebd83d9fe356a..d8eda636b96ce 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 03729d0b48646..b2fcc8a37e7ce 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 29194349328b0..9d02e8e3e8913 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 7fc4012f1e122..4d80fd6dbb568 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 a75ab5ca9c742..4222878455023 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 5c796d58e8249..8b7a689310f40 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 2dfefd205619f..81f44778d1f00 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 0c1b7fcd49808..fa03525a06790 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 9dbeb5b151a46..cdfdb13c40724 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 e887b8fc03c08..2e65b80aaa4be 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 87d25650efd51..4566514baa3fb 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 c4c451c51a35f..7856b65133cb2 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 e2660d0f65413..5bcab1dba353e 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 8c6338c8026f3..66eb55acee415 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 0c77d5f6a16bb..a87560d96bc85 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 15366afc747cb..2ef1bc0ad8ed4 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 545cf55e37213..4d1cad9723532 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 4d54da1d33c6c..1d893ff36c0cc 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 8f5e7b7b9d714..329e4ca2805cd 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 e30e6945d5964..7d77a2da51bd9 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 3c4800ce3c5e4..e1a9c27782a31 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 5696ef254227b..ff753ecf74389 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 f0b378d8d47e2..ee143e42cdf09 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 545cf55e37213..4d1cad9723532 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 437a7885819b2..6683147bc8a09 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 ea091e9b1d55f..0596c676a2875 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 05667daec5a37..5d4dfec76a651 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 2535f8d9e22df..8c76eea1c055c 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 7827f47d5a9e6..0895fb27dd5ec 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 12c3cbaafdeba..e588d442b8836 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 fba048474b4a9..52aa997e4effa 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 dd6bd19b4188c..b3860c9c14f90 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 21e117360601a..8109a389b2758 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 132444f96dd3b..a4de36c3e4488 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 5696ef254227b..ff753ecf74389 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 1ad490b39d88f..49e2dd72d3fff 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 5084e61059e09..30f697a3a5e4f 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 d3a19ebbe8729..13e79154c1655 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 8d2814a52a40e..5b32e5b571eea 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 3ad7e698fe6b0..8a2f9e16ae4b9 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 d58cb40f1e4cc..edca3c3e810a4 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 62e54e9d80595..f80575a5c66fa 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 ec271d13058b4..5e65dd8a39d1c 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 62e54e9d80595..f80575a5c66fa 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 89f1679a796f1..8d29584a1ec20 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 e9e30a5295b3c..b3ec27d322864 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 41974b23ddb07..4da88ef59bfe5 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 26d08b82b2df5..0886b269ec202 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 62e54e9d80595..f80575a5c66fa 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 aac95ff8adc91..eb3352a24031e 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)