docs: replace with LegacyApiKeys component

This commit is contained in:
Kang Ming committed 2024-10-08 22:27:07 +08:00
1 parent 30472c7fc5
commit 3ffaffc0ed
22 files changed
+25 -25

No files matched your search

+1 -1
View File
@@ -15,4 +15,4 @@ Your database will be available in less than a minute.
You can find your project credentials inside the project [settings](https://supabase.com/dashboard/project/_/settings/), including:
- [Database credentials](https://supabase.com/dashboard/project/_/settings/database): connection strings and connection pooler details.
- [API credentials](https://supabase.com/dashboard/project/_/settings/database): your serverless API URL and <PublishableKey/> / `service_role` keys.
- [API credentials](https://supabase.com/dashboard/project/_/settings/database): your serverless API URL and <LegacyApiKeys keyword='publishable' type='anon'/> / `service_role` keys.
@@ -40,10 +40,10 @@ Now we are going to set up the database schema. You can just copy/paste the SQL
### Get the API Keys
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
We just need to get the Project URL and <PublishableKey/> key from the API settings.
We just need to get the Project URL and <LegacyApiKeys keyword='publishable' type='anon'/> key from the API settings.
1. Go to the [API Settings](https://app.supabase.com/project/_/settings/api) page in the Dashboard.
2. Find your Project `URL`, <PublishableKey/>, and `service_role` keys on this page.
2. Find your Project `URL`, <LegacyApiKeys keyword='publishable' type='anon'/>, and `service_role` keys on this page.
### Set up Google Authentication
+2 -2
View File
@@ -62,7 +62,7 @@ supabase migration new user_management_starter
### Get the API Keys
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
We just need to get the Project URL and <PublishableKey/> key from the API settings.
We just need to get the Project URL and <LegacyApiKeys keyword='publishable' type='anon'/> key from the API settings.
1. Go to the [API Settings](https://supabase.com/dashboard/project/_/settings/api) page in the Dashboard.
1. Find your Project `URL`, <PublishableKey/>, and `service_role` keys on this page.
1. Find your Project `URL`, <LegacyApiKeys keyword='publishable' type='anon'/>, and `service_role` keys on this page.
+1 -1
View File
@@ -4,7 +4,7 @@ title: 'Understanding API Keys'
description: 'Securing your Data API with Postgres Row Level Security.'
---
Supabase provides 2 default keys when you create a project: a <PublishableKey/> key, and a `secret` key. You can find both keys in the [API Settings](https://supabase.com/dashboard/project/_/settings/api).
Supabase provides 2 default keys when you create a project: a <LegacyApiKeys keyword='publishable' type='anon'/> key, and a <LegacyApiKeys keyword='secret' type='secret'/> key. You can find both keys in the [API Settings](https://supabase.com/dashboard/project/*/settings/api).
The data APIs are designed to work with Postgres Row Level Security (RLS). These keys map to the following Postgres roles:
@@ -54,7 +54,7 @@ Every Supabase project has a unique API URL. Your API is secured behind an API g
1. Go to the [Settings](https://supabase.com/dashboard/project/_/settings/general) page in the Dashboard.
2. Click **API** in the sidebar.
3. Find your API `URL`, <PublishableKey/>, and `service_role` keys on this page.
3. Find your API `URL`, <LegacyApiKeys keyword='publishable' type='anon'/>, and `service_role` keys on this page.
<video width="99%" muted playsInline controls={true}>
<source
@@ -65,7 +65,7 @@ Every Supabase project has a unique API URL. Your API is secured behind an API g
The REST API is accessible through the URL `https://<project_ref>.supabase.co/rest/v1`
Both of these routes require the <PublishableKey/> key to be passed through an `apikey` header.
Both of these routes require the <LegacyApiKeys keyword='publishable' type='anon'/> key to be passed through an `apikey` header.
## Using the API
@@ -12,7 +12,7 @@ Calling `signInAnonymously()` creates an anonymous user. It's just like a perman
Like permanent users, the `authenticated` Postgres role will be used when using the Data APIs to access your project. JWTs for these users will have an `is_anonymous` claim which you can use to distinguish in RLS policies.
This is different from the <PublishableKey/> API key which does not create a user and can be used to implement public access to your database as it uses the `anon` Postgres role.
This is different from the <LegacyApiKeys keyword='publishable' type='anon'/> API key which does not create a user and can be used to implement public access to your database as it uses the `anon` Postgres role.
</Admonition>
@@ -36,7 +36,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in the `src/environments/environment.ts` file.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
These variables will be exposed on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
```ts src/environments/environment.ts
@@ -38,7 +38,7 @@ npx expo install @supabase/supabase-js @react-native-async-storage/async-storage
```
Now let's create a helper file to initialize the Supabase client.
We need the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
We need the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
These variables are safe to expose in your Expo app since Supabase has
[Row Level Security](/docs/guides/auth#row-level-security) enabled on your Database.
@@ -37,7 +37,7 @@ npm install @supabase/supabase-js
```
And finally, we want to save the environment variables in the `src/environments/environment.ts` file.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
These variables will be exposed on the browser, and that's completely fine since we have [Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
```ts environment.ts
@@ -37,7 +37,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
REACT_APP_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -37,7 +37,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
VUE_APP_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -55,7 +55,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env.local`.
Create a `.env.local` file at the root of the project, and paste the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
Create a `.env.local` file at the root of the project, and paste the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env.local
NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -36,7 +36,7 @@ npm install @nuxtjs/supabase --save-dev
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
SUPABASE_URL="YOUR_SUPABASE_URL"
@@ -36,7 +36,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env.local` file.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -103,7 +103,7 @@ Say, **yes** and it will setup the Supabase client in your app and also provide
```
Next, we want to save the environment variables in a `.env`.
We need the `API URL` as well as the <PublishableKey/> and `jwt_secret` keys that you copied [earlier](#get-the-api-keys).
We need the `API URL` as well as the <LegacyApiKeys keyword='publishable' type='anon'/> and `jwt_secret` keys that you copied [earlier](#get-the-api-keys).
```bash .env
SUPABASE_URL=YOUR_SUPABASE_URL
@@ -83,7 +83,7 @@ export const supabaseClient = createClient(supabaseUrl, supabaseAnonKey, {
})
```
And then, we want to save the environment variables in a `.env.local` file. All you need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
And then, we want to save the environment variables in a `.env.local` file. All you need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env.local
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -35,7 +35,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -36,7 +36,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -28,7 +28,7 @@ Add the [supabase-swift](https://github.com/supabase/supabase-swift) dependency.
Add the `https://github.com/supabase/supabase-swift` package to your app. For instructions, see the [Apple tutorial on adding package dependencies](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app).
Create a helper file to initialize the Supabase client.
You need the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
You need the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
These variables will be exposed on the application, and that's completely fine since you have
[Row Level Security](/docs/guides/auth#row-level-security) enabled on your database.
@@ -41,7 +41,7 @@ npm install @supabase/supabase-js
```
And finally we want to save the environment variables in a `.env`.
All we need are the API URL and the <PublishableKey/> key that you copied [earlier](#get-the-api-keys).
All we need are the API URL and the <LegacyApiKeys keyword='publishable' type='anon'/> key that you copied [earlier](#get-the-api-keys).
```bash .env
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
@@ -12,7 +12,7 @@ You can use the Supabase client libraries to send and receive Broadcast messages
### Initialize the client
Go to your Supabase project's [API Settings](https://supabase.com/dashboard/project/_/settings/api) and grab the `URL` and <PublishableKey/> key.
Go to your Supabase project's [API Settings](https://supabase.com/dashboard/project/_/settings/api) and grab the `URL` and <LegacyApiKeys keyword='publishable' type='anon'/> key.
<Tabs
scrollable
@@ -12,7 +12,7 @@ You can use the Supabase client libraries to track Presence state between users.
### Initialize the client
Go to your Supabase project's [API Settings](https://supabase.com/dashboard/project/_/settings/api) and grab the `URL` and <PublishableKey/> key.
Go to your Supabase project's [API Settings](https://supabase.com/dashboard/project/_/settings/api) and grab the `URL` and <LegacyApiKeys keyword='publishable' type='anon'/> key.
<Tabs
scrollable