Skip to content

Commit d91ea9d

Browse files
docs: Clear up keys and connection instructions in web getting started guides [DO NOT MERGE] (supabase#38554)
* Clearup keys and connection instructions in web getting started guides * Update apps/docs/content/_partials/project_setup.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update apps/docs/content/_partials/project_setup.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * prettier * second try * Fix keys for getting started section * Updated keys for auth section, SSR aside * Remove mention of dropdowns for now --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 262265e commit d91ea9d

24 files changed

+79
-58
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### Get API details
2+
3+
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
4+
5+
To do this, you need to get the Project URL and key. Get the URL from [the API settings section](/dashboard/project/_/settings/api) of a project and the key from the [the API Keys section of a project's Settings page](/dashboard/project/_/settings/api-keys/).
6+
7+
<Admonition type="note" title="Changes to API keys">
8+
9+
Supabase is changing the way keys work to improve project security and developer experience. You can [read the full announcement](https://github.com/orgs/supabase/discussions/29260), but in the transition period, you can use both the current `anon` and `service_role` keys and the new publishable key with the form `sb_publishable_xxx` which will replace the older keys.
10+
11+
To get the key values, open [the API Keys section of a project's Settings page](/dashboard/project/_/settings/api-keys/) and do the following:
12+
13+
- **For legacy keys**, copy the `anon` key for client-side operations and the `service_role` key for server-side operations from the **Legacy API Keys** tab.
14+
- **For new keys**, open the **API Keys** tab, if you don't have a publishable key already, click **Create new API Keys**, and copy the value from the **Publishable key** section.
15+
16+
</Admonition>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{/* TODO: How to completely consolidate partials? */}
2+
3+
<Admonition type="note" title="Changes to API keys">
4+
5+
Supabase is changing the way keys work to improve project security and developer experience. You can [read the full announcement](https://github.com/orgs/supabase/discussions/29260), but in the transition period, you can use both the current `anon` and `service_role` keys and the new publishable key with the form `sb_publishable_xxx` which will replace the older keys.
6+
7+
To get the key values, open [the API Keys section of a project's Settings page](/dashboard/project/_/settings/api-keys/) and do the following:
8+
9+
- **For legacy keys**, copy the `anon` key for client-side operations and the `service_role` key for server-side operations from the **Legacy API Keys** tab.
10+
- **For new keys**, open the **API Keys** tab, if you don't have a publishable key already, click **Create new API Keys**, and copy the value from the **Publishable key** section.
11+
12+
</Admonition>

apps/docs/content/_partials/kotlin_project_setup.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ Now we are going to set up the database schema. You can just copy/paste the SQL
3333
</TabPanel>
3434
</Tabs>
3535

36-
### Get the API keys
37-
38-
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
39-
We just need to get the Project URL and `anon` key from the API settings.
40-
41-
1. Go to the [API Settings](https://app.supabase.com/project/_/settings/api) page in the Dashboard.
42-
2. Find your Project `URL`, `anon`, and `service_role` keys on this page.
36+
<$Partial path="api_settings.mdx" />
4337

4438
### Set up Google authentication
4539

apps/docs/content/_partials/project_setup.mdx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,4 @@ supabase migration new user_management_starter
5555
</TabPanel>
5656
</Tabs>
5757

58-
### Get the API keys
59-
60-
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
61-
62-
To do this, you need to get the Project URL and `anon` key from the API settings.
63-
64-
1. Go to the [API Settings](/dashboard/project/_/settings/api) page in the Dashboard.
65-
2. Find your Project `URL`, `anon`, and `service_role` keys on this page.
58+
<$Partial path="api_settings.mdx" />

apps/docs/content/guides/auth/quickstarts/nextjs.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ hideToc: true
5252
<StepHikeCompact.Step step={3}>
5353
<StepHikeCompact.Details title="Declare Supabase Environment Variables">
5454

55-
Rename `.env.example` to `.env.local` and populate with [your project's URL and Anon Key](/dashboard/project/_/settings/api).
55+
Rename `.env.example` to `.env.local` and populate with [your project's URL and Key](/dashboard/project/_/settings/api).
56+
57+
<$Partial path="api_settings_steps.mdx" />
5658
5759
</StepHikeCompact.Details>
5860
5961
<StepHikeCompact.Code>
6062
6163
```text name=.env.local
62-
NEXT_PUBLIC_SUPABASE_URL=your-project-url
63-
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon key
64+
NEXT_PUBLIC_SUPABASE_URL=your-project-url
65+
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_... or anon key
6466
```
6567
6668
</StepHikeCompact.Code>

apps/docs/content/guides/auth/quickstarts/react-native.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ hideToc: true
6464
<StepHikeCompact.Step step={4}>
6565
<StepHikeCompact.Details title="Set up your login component">
6666

67-
Create a helper file `lib/supabase.ts` that exports a Supabase client using your [Project URL and public API (anon) key](/dashboard/project/_/settings/api).
67+
Create a helper file `lib/supabase.ts` that exports a Supabase client using your Project URL and key.
68+
69+
<$Partial path="api_settings_steps.mdx" />
6870

6971
</StepHikeCompact.Details>
7072
<StepHikeCompact.Code>

apps/docs/content/guides/auth/quickstarts/react.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ hideToc: true
6464
<StepHikeCompact.Step step={4}>
6565
<StepHikeCompact.Details title="Set up your login component">
6666
67-
In `App.jsx`, create a Supabase client using your [Project URL and public API (anon) key](/dashboard/project/_/settings/api).
67+
In `App.jsx`, create a Supabase client using your Project URL and key.
68+
69+
<$Partial path="api_settings_steps.mdx" />
6870
6971
You can configure the Auth component to display whenever there is no session inside `supabase.auth.getSession()`
7072

apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ hideToc: true
7474
runtimeConfig: {
7575
public: {
7676
supabaseUrl: process.env.SUPABASE_URL,
77-
supabaseAnonKey: process.env.SUPABASE_PUBLISHABLE_KEY,
77+
supabasePublishableKey: process.env.SUPABASE_PUBLISHABLE_KEY,
7878
},
7979
},
8080
});
@@ -99,7 +99,7 @@ hideToc: true
9999
<script setup>
100100
import { createClient } from '@supabase/supabase-js'
101101
const config = useRuntimeConfig()
102-
const supabase = createClient(config.public.supabaseUrl, config.public.supabaseAnonKey)
102+
const supabase = createClient(config.public.supabaseUrl, config.public.supabasePublishableKey)
103103
const instruments = ref([])
104104
105105
async function getInstruments() {

apps/docs/content/guides/getting-started/quickstarts/vue.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ hideToc: true
8888
import { createClient } from '@supabase/supabase-js'
8989

9090
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
91-
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY
91+
const supabasePublishableKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY
9292

93-
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
93+
export const supabase = createClient(supabaseUrl, supabasePublishableKey)
9494
```
9595

9696
</StepHikeCompact.Code>

apps/docs/content/guides/getting-started/tutorials/with-angular.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install @supabase/supabase-js
3636
```
3737

3838
Finally, save the environment variables in the `src/environments/environment.ts` file.
39-
All you need are the API URL and the `anon` key that you copied [earlier](#get-the-api-keys).
39+
All you need are the API URL and the key that you copied [earlier](#get-api-details).
4040
The application exposes these variables in the browser, and that's fine as you have [Row Level Security](/docs/guides/auth#row-level-security) enabled on the Database.
4141

4242
<$CodeTabs>

0 commit comments

Comments
 (0)