Skip to content

Commit a725766

Browse files
docs: Update key usage in QuickStarts (supabase#44434)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated all quickstart guides and tutorials to reference publishable keys instead of anon keys for Supabase client initialization. * Simplified environment variable setup instructions across multiple framework guides by removing anon key configuration requirements. * Clarified usage of publishable keys in step-by-step setup documentation for various frameworks and platforms. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: fadymak <dev@fadymak.com>
1 parent 30c16da commit a725766

File tree

22 files changed

+32
-34
lines changed

22 files changed

+32
-34
lines changed

apps/docs/app/contributing/content.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,10 @@ Some guides and tutorials will require that users copy their Supabase project UR
359359
```mdx
360360
<ProjectConfigVariables variable="url" />
361361
<ProjectConfigVariables variable="publishable" />
362-
<ProjectConfigVariables variable="anon" />
363362
```
364363

365364
<ProjectConfigVariables variable="url" />
366365
<ProjectConfigVariables variable="publishable" />
367-
<ProjectConfigVariables variable="anon" />
368366

369367
### Step Hike
370368

apps/docs/content/_partials/api_settings.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ Now that you've created some database tables, you are ready to insert data using
44

55
To do this, you need to get the Project URL and key from [the project **Connect** dialog](/dashboard/project/\_?showConnect=true&connectTab={{ .tab }}&framework={{ .framework }}).
66

7+
[Read the API keys docs](/docs/guides/api/api-keys) for a full explanation of all key types and their uses.
8+
79
<Admonition type="note" title="Changes to API keys">
810

911
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.
1012

13+
**The legacy keys will be deprecated shortly, so we strongly encourage switching to and using the new publishable and secret API keys**.
14+
1115
In most cases, you can get the correct key from [the Project's **Connect** dialog](/dashboard/project/\_?showConnect=true&connectTab={{ .tab }}&framework={{ .framework }}), but if you want a specific key, you can find all keys in [the API Keys section of a Project's Settings page](/dashboard/project/_/settings/api-keys/):
1216

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.
17+
**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.
1518

1619
</Admonition>
17-
18-
[Read the API keys docs](/docs/guides/api/api-keys) for a full explanation of all key types and their uses.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ hideToc: true
5656

5757
<ProjectConfigVariables variable="url" />
5858
<ProjectConfigVariables variable="publishable" />
59-
<ProjectConfigVariables variable="anon" />
59+
6060

6161
</StepHikeCompact.Details>
6262

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ hideToc: true
7070

7171
<ProjectConfigVariables variable="url" />
7272
<ProjectConfigVariables variable="publishable" />
73-
<ProjectConfigVariables variable="anon" />
73+
7474

7575
</StepHikeCompact.Details>
7676
<StepHikeCompact.Code>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ hideToc: true
6767

6868
<ProjectConfigVariables variable="url" />
6969
<ProjectConfigVariables variable="publishable" />
70-
<ProjectConfigVariables variable="anon" />
70+
7171

7272

7373
</StepHikeCompact.Details>

apps/docs/content/guides/auth/server-side/creating-a-client.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Create a `.env.local` file in the project root directory. In the file, set the p
4343

4444
<ProjectConfigVariables variable="url" />
4545
<ProjectConfigVariables variable="publishable" />
46-
<ProjectConfigVariables variable="anon" />
4746

4847
<$Partial path="api_settings_steps.mdx" variables={{ "framework": "nextjs", "tab": "frameworks" }} />
4948

apps/docs/content/guides/getting-started/quickstarts/expo-react-native.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ hideToc: true
6161

6262
<ProjectConfigVariables variable="url" />
6363
<ProjectConfigVariables variable="publishable" />
64-
<ProjectConfigVariables variable="anon" />
64+
6565

6666
</StepHikeCompact.Details>
6767

@@ -94,9 +94,9 @@ hideToc: true
9494
import 'expo-sqlite/localStorage/install';
9595

9696
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL
97-
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY
97+
const supabasePublishableKey = process.env.EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY
9898

99-
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
99+
export const supabase = createClient(supabaseUrl, supabasePublishableKey, {
100100
auth: {
101101
storage: localStorage,
102102
autoRefreshToken: true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ hideToc: true
5959

6060
<ProjectConfigVariables variable="url" />
6161
<ProjectConfigVariables variable="publishable" />
62-
<ProjectConfigVariables variable="anon" />
62+
6363

6464
</StepHikeCompact.Details>
6565

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ hideToc: true
5555
5656
<StepHikeCompact.Details title="Initialize the Supabase client">
5757
58-
Open `lib/main.dart` and edit the main function to initialize Supabase using your project URL and public API (anon) key:
58+
Open `lib/main.dart` and edit the main function to initialize Supabase using your project URL and publishable key:
5959

6060
<ProjectConfigVariables variable="url" />
6161
<ProjectConfigVariables variable="publishable" />
62-
<ProjectConfigVariables variable="anon" />
62+
6363

6464
</StepHikeCompact.Details>
6565

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ hideToc: true
4545
<StepHikeCompact.Step step={3}>
4646
<StepHikeCompact.Details title="Set up the required environment variables">
4747

48-
Copy the `.env.example` file to `.env` and update the values with your Supabase project URL and anon key.
48+
Copy the `.env.example` file to `.env` and update the values with your Supabase project URL and publishable key.
4949

5050
Lastly, [enable anonymous sign-ins](/dashboard/project/_/auth/providers) in the Auth settings.
5151

5252
<ProjectConfigVariables variable="url" />
5353
<ProjectConfigVariables variable="publishable" />
54-
<ProjectConfigVariables variable="anon" />
54+
5555

5656
</StepHikeCompact.Details>
5757
<StepHikeCompact.Code>

0 commit comments

Comments
 (0)