mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix: standardize headings sentence case in docs (#19954)
* fix: standardize headings sentence case in docs * Revert exceptions
This commit is contained in:
1 parent
b514ad10f1
commit
671b05bc4b
175 files changed
+508
-508
No files matched your search
@@ -21,7 +21,7 @@ The number of dimensions in your embeddings is the most important factor in choo
|
||||
|
||||
## HNSW
|
||||
|
||||
### 384 Dimensions
|
||||
### 384 dimensions
|
||||
|
||||
This benchmark uses the dbpedia-entities-openai-1M dataset containing 1,000,000 embeddings of text, regenerated for 384 dimension embeddings. Each embedding is generated using [gte-small](https://huggingface.co/Supabase/gte-small).
|
||||
|
||||
@@ -52,7 +52,7 @@ Accuracy was 0.99 for benchmarks.
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### 960 Dimensions
|
||||
### 960 dimensions
|
||||
|
||||
This benchmark uses the [gist-960](http://corpus-texmex.irisa.fr/) dataset, which contains 1,000,000 embeddings of images. Each embedding is 960 dimensions.
|
||||
|
||||
@@ -85,7 +85,7 @@ QPS can also be improved by increasing [`m` and `ef_construction`](/docs/guides/
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### 1536 Dimensions
|
||||
### 1536 dimensions
|
||||
|
||||
This benchmark uses the [dbpedia-entities-openai-1M](https://huggingface.co/datasets/KShivendu/dbpedia-entities-openai-1M) dataset, which contains 1,000,000 embeddings of text. And 224,482 embeddings from [Wikipedia articles](https://huggingface.co/datasets/Supabase/wikipedia-en-embeddings) for compute add-ons `large` and below. Each embedding is 1536 dimensions created with the [OpenAI Embeddings API](https://platform.openai.com/docs/guides/embeddings).
|
||||
|
||||
@@ -136,7 +136,7 @@ It is possible to upload more vectors to a single table if Memory allows it (for
|
||||
|
||||
## IVFFlat
|
||||
|
||||
### 384 Dimensions
|
||||
### 384 dimensions
|
||||
|
||||
This benchmark uses the dbpedia-entities-openai-1M dataset containing 1,000,000 embeddings of text, regenerated for 384 dimension embeddings. Each embedding is generated using [gte-small](https://huggingface.co/Supabase/gte-small).
|
||||
|
||||
@@ -181,7 +181,7 @@ This benchmark uses the dbpedia-entities-openai-1M dataset containing 1,000,000
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### 960 Dimensions
|
||||
### 960 dimensions
|
||||
|
||||
This benchmark uses the [gist-960](http://corpus-texmex.irisa.fr/) dataset, which contains 1,000,000 embeddings of images. Each embedding is 960 dimensions.
|
||||
|
||||
@@ -210,7 +210,7 @@ This benchmark uses the [gist-960](http://corpus-texmex.irisa.fr/) dataset, whic
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### 1536 Dimensions
|
||||
### 1536 dimensions
|
||||
|
||||
This benchmark uses the [dbpedia-entities-openai-1M](https://huggingface.co/datasets/KShivendu/dbpedia-entities-openai-1M) dataset, which contains 1,000,000 embeddings of text. Each embedding is 1536 dimensions created with the [OpenAI Embeddings API](https://platform.openai.com/docs/guides/embeddings).
|
||||
|
||||
@@ -322,7 +322,7 @@ You can increase the Requests per Second by increasing `m` and `ef_construction`
|
||||
|
||||
Check out more tips and the complete step-by-step guide in [Going to Production for AI applications](going-to-prod).
|
||||
|
||||
## Benchmark Methodology
|
||||
## Benchmark methodology
|
||||
|
||||
We follow techniques outlined in the [ANN Benchmarks](https://github.com/erikbern/ann-benchmarks) methodology. A Python test runner is responsible for uploading the data, creating the index, and running the queries. The pgvector engine is implemented using [vecs](https://github.com/supabase/vecs), a Python client for pgvector.
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ A [Retrieval Plugin](https://github.com/openai/chatgpt-retrieval-plugin) is a Py
|
||||
|
||||
It allows ChatGPT to dynamically pull relevant information into conversations from your data sources. This could be PDF documents, Confluence, or Notion knowledge bases.
|
||||
|
||||
## Example: Chat with Postgres Docs
|
||||
## Example: Chat with Postgres docs
|
||||
|
||||
Let’s build an example where we can “ask ChatGPT questions” about the Postgres documentation. Although ChatGPT already knows about the Postgres documentation because it is publicly available, this is a simple example which demonstrates how to work with PDF files.
|
||||
|
||||
@@ -74,7 +74,7 @@ export PG_HOST=<postgres_host_url>
|
||||
export PG_PASSWORD=<postgres_password>
|
||||
```
|
||||
|
||||
### Step 4: Run Postgres Locally
|
||||
### Step 4: Run Postgres locally
|
||||
|
||||
To start quicker you may use Supabase CLI to spin everything up locally as it already includes pgvector from the start. Install `supabase-cli`, go to the `examples/providers` folder in the repo and run:
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ We can combine Hugging Face with [Supabase Storage](https://supabase.com/storage
|
||||
- Deploy the function to Supabase: `supabase functions deploy huggingface-image-captioning`.
|
||||
- Create the Database Webhook in the [Supabase Dashboard](https://supabase.com/dashboard/project/_/database/hooks) to trigger the `huggingface-image-captioning` function anytime a record is added to the `storage.objects` table.
|
||||
|
||||
## Generate TypeScript Types
|
||||
## Generate TypeScript types
|
||||
|
||||
To generate the types.ts file for the storage and public schemas, run the following command in the terminal:
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ The [OpenAI CLIP Model](https://github.com/openai/CLIP) was trained on a variety
|
||||
|
||||
You can find the full application code as a Python Poetry project on [GitHub](https://github.com/supabase/supabase/tree/master/examples/ai/image_search#image-search-with-supabase-vector).
|
||||
|
||||
## Create a new Python Project with Poetry
|
||||
## Create a new Python project with Poetry
|
||||
|
||||
[Poetry](https://python-poetry.org/) provides packaging and dependency management for Python. If you haven't already, install poetry via pip:
|
||||
|
||||
@@ -46,7 +46,7 @@ supabase start
|
||||
|
||||
This will start up the Supabase stack locally and print out a bunch of environment details, including your local `DB URL`. Make a note of that for later user.
|
||||
|
||||
## Install the Dependencies
|
||||
## Install the dependencies
|
||||
|
||||
We will need to add the following dependencies to our project:
|
||||
|
||||
@@ -134,7 +134,7 @@ search = "image_search.main:search"
|
||||
|
||||
After activating the virtual environtment with `poetry shell` you can now run your seed script via `poetry run seed`. You can inspect the generated embeddings in your local database by visiting the local Supabase dashboard at [localhost:54323](http://localhost:54323/project/default/editor), selecting the `vecs` schema, and the `image_vectors` database.
|
||||
|
||||
## Perform an Image Search from a Text Query
|
||||
## Perform an image search from a text query
|
||||
|
||||
With Supabase Vector we can easily query our embeddings. We can use either an image as search input or alternative we can generate an embedding from a string input and use that as the query input:
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ With our database set up, we need to process and store all `.mdx` files in the `
|
||||
|
||||
</StepHikeCompact>
|
||||
|
||||
## Create Text Completion with OpenAI API
|
||||
## Create text completion with OpenAI API
|
||||
|
||||
Anytime a user asks a question, we need to create an embedding for their question, perform a similarity search, and then send a text completion request to the OpenAI API with the query and then context content merged together into a prompt.
|
||||
|
||||
@@ -527,7 +527,7 @@ const handleConfirm = React.useCallback(
|
||||
)
|
||||
```
|
||||
|
||||
## Learn More
|
||||
## Learn more
|
||||
|
||||
Want to learn more about the awesome tech that is powering this?
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ You can find more examples of how `lists` and `probes` constants affect accuracy
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Performance Tips when using indexes
|
||||
## Performance tips when using indexes
|
||||
|
||||
First, a few generic tips which you can pick and choose from:
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ There are 3 ways to use Hugging Face models in your application:
|
||||
1. [Generate embeddings](/docs/guides/ai/quickstarts/generate-text-embeddings) directly in Edge Functions using Transformers.js.
|
||||
1. Use Hugging Face's hosted [Inference API](https://huggingface.co/inference-api) to execute AI tasks remotely on Hugging Face servers. This guide will walk you through this approach.
|
||||
|
||||
## AI Tasks
|
||||
## AI tasks
|
||||
|
||||
Below are some of the types of tasks you can perform with Hugging Face:
|
||||
|
||||
@@ -27,7 +27,7 @@ Below are some of the types of tasks you can perform with Hugging Face:
|
||||
- [Translation](https://huggingface.co/tasks/translation)
|
||||
- [Fill in the blank](https://huggingface.co/tasks/fill-mask)
|
||||
|
||||
### Computer Vision
|
||||
### Computer vision
|
||||
|
||||
- [Image to text](https://huggingface.co/tasks/image-to-text)
|
||||
- [Text to image](https://huggingface.co/tasks/text-to-image)
|
||||
|
||||
@@ -12,13 +12,13 @@ In this guide, we will walk through two examples of using [Roboflow Inference](h
|
||||
|
||||
<DatabaseSetup />
|
||||
|
||||
## Save Computer Vision Predictions
|
||||
## Save computer vision predictions
|
||||
|
||||
Once you have a trained vision model, you need to create business logic for your application. In many cases, you want to save inference results to a file.
|
||||
|
||||
The steps below show you how to run a vision model locally and save predictions to Supabase.
|
||||
|
||||
### Preparation: Set up a Model
|
||||
### Preparation: Set up a model
|
||||
|
||||
Before you begin, you will need an object detection model trained on your data.
|
||||
|
||||
@@ -28,7 +28,7 @@ All models have an infinitely scalable API through which you can query your mode
|
||||
|
||||
For this guide, we will use a demo [rock, paper, scissors](https://universe.roboflow.com/roboflow-58fyf/rock-paper-scissors-sxsw) model.
|
||||
|
||||
### Step 1: Install and Start Roboflow Inference
|
||||
### Step 1: Install and start Roboflow Inference
|
||||
|
||||
You will deploy our model locally using Roboflow Inference, a computer vision inference server.
|
||||
|
||||
@@ -42,7 +42,7 @@ pip install inference inference-cli inference-sdk && inference server start
|
||||
|
||||
An inference server will be available at `http://localhost:9001`.
|
||||
|
||||
### Step 2: Run Inference on an Image
|
||||
### Step 2: Run inference on an image
|
||||
|
||||
You can run inference on images and videos. Let's run inference on an image.
|
||||
|
||||
@@ -76,7 +76,7 @@ When you run the code above, a list of predictions will be printed to the consol
|
||||
{'time': 0.05402109300121083, 'image': {'width': 640, 'height': 480}, 'predictions': [{'x': 312.5, 'y': 392.0, 'width': 255.0, 'height': 110.0, 'confidence': 0.8620790839195251, 'class': 'Paper', 'class_id': 0}]}
|
||||
```
|
||||
|
||||
### Step 3: Save Results in Supabase
|
||||
### Step 3: Save results in Supabase
|
||||
|
||||
To save results in Supabase, add the following code to your script:
|
||||
|
||||
@@ -110,17 +110,17 @@ Here is an example result:
|
||||
data=[{'predictions': {'time': 0.08492901099998562, 'image': {'width': 640, 'height': 480}, 'predictions': [{'x': 312.5, 'y': 392.0, 'width': 255.0, 'height': 110.0, 'confidence': 0.8620790839195251, 'class': 'Paper', 'class_id': 0}]}}, {'predictions': {'time': 0.08818970100037404, 'image': {'width': 640, 'height': 480}, 'predictions': [{'x': 312.5, 'y': 392.0, 'width': 255.0, 'height': 110.0, 'confidence': 0.8620790839195251, 'class': 'Paper', 'class_id': 0}]}}] count=None
|
||||
```
|
||||
|
||||
## Calculate and Save CLIP Embeddings
|
||||
## Calculate and save CLIP embeddings
|
||||
|
||||
You can use the Supabase vector database functionality to store and query CLIP embeddings.
|
||||
|
||||
Roboflow Inference provides a HTTP interface through which you can calculate image and text embeddings using CLIP.
|
||||
|
||||
### Step 1: Install and Start Roboflow Inference
|
||||
### Step 1: Install and start Roboflow Inference
|
||||
|
||||
See [Step #1: Install and Start Roboflow Inference](#step-1-install-and-start-roboflow-inference) above to install and start Roboflow Inference.
|
||||
|
||||
### Step 2: Run CLIP on an Image
|
||||
### Step 2: Run CLIP on an image
|
||||
|
||||
Create a new Python file and add the following code:
|
||||
|
||||
@@ -168,7 +168,7 @@ Above, replace:
|
||||
|
||||
You can also calculate CLIP embeddings in the cloud by setting `SERVER_URL` to `https://infer.roboflow.com`.
|
||||
|
||||
### Step 3: Save Embeddings in Supabase
|
||||
### Step 3: Save embeddings in Supabase
|
||||
|
||||
You can store your image embeddings in Supabase using the Supabase `vecs` Python package:
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ export const run = async () => {
|
||||
}
|
||||
```
|
||||
|
||||
### Simple Metadata Filtering
|
||||
### Simple metadata filtering
|
||||
|
||||
Given the above `match_documents` Postgres function, you can also pass a filter parameter to only return documents with a specific metadata field value. This filter parameter is a JSON object, and the `match_documents` function will use the Postgres JSONB Containment operator `@>` to filter documents by the metadata field values you specify. See details on the [Postgres JSONB Containment operator](https://www.postgresql.org/docs/current/datatype-json.html#JSON-CONTAINMENT) for more information.
|
||||
|
||||
@@ -150,7 +150,7 @@ export const run = async () => {
|
||||
}
|
||||
```
|
||||
|
||||
### Advanced Metadata Filtering
|
||||
### Advanced metadata filtering
|
||||
|
||||
You can also use query builder-style filtering ([similar to how the Supabase JavaScript library works](https://supabase.com/docs/reference/javascript/using-filters)) instead of passing an object. Note that since the filter properties will be in the metadata column, you need to use arrow operators (`->` for integer or `->>` for text) as defined in [Postgrest API documentation](https://postgrest.org/en/stable/references/api/tables_views.html?highlight=operators#json-columns) and specify the data type of the property (e.g. the column should look something like `metadata->some_int_value::int`).
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ order by document_sections.embedding <#> embedding;
|
||||
|
||||
The above example only configures `select` access to users. If you wanted, you could create more RLS policies for inserts, updates, and deletes in order to apply the same permission logic for those other operations. See [Row Level Security](/docs/guides/database/postgres/row-level-security) for a more in-depth guide on RLS policies.
|
||||
|
||||
## Alternative Scenarios
|
||||
## Alternative scenarios
|
||||
|
||||
Every app has its own unique requirements and may differ from the above example. Here are some alternative scenarios we often see and how they are implemented in Supabase.
|
||||
|
||||
@@ -189,7 +189,7 @@ Since we're managing users and authentication outside of Supabase, we have two o
|
||||
1. Make a direct Postgres connection to the Supabase DB and set the current user every request
|
||||
2. Issue a custom JWT from your system and use it to authenticate with the REST API
|
||||
|
||||
#### Direct Postgres Connection
|
||||
#### Direct Postgres connection
|
||||
|
||||
You can directly connect to your Supabase Postgres DB using the [connection info](/dashboard/project/_/settings/database) on your project's database settings page. To use RLS with this method, we use a custom session variable that contains the current user's ID:
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ docs.query(
|
||||
)
|
||||
```
|
||||
|
||||
## Deep Dive
|
||||
## Deep dive
|
||||
|
||||
For a more in-depth guide on `vecs` collections, see [API](/docs/guides/ai/python/api).
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Reference:
|
||||
- [Docs](https://postgrest.org/)
|
||||
- [Source Code](https://github.com/PostgREST/postgrest)
|
||||
|
||||
## API URL and Keys
|
||||
## API URL and keys
|
||||
|
||||
You can find the API URL and Keys in the [Dashboard](https://supabase.com/dashboard/project/_/settings/api).
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ create table
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## API URL and Keys
|
||||
## API URL and keys
|
||||
|
||||
Every Supabase project has a unique API URL. Your API is secured behind an API gateway which requires an API Key for every request.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const meta = {
|
||||
|
||||
Supabase's auto-generated Data APIs let you perform operations on your database using REST API calls. You can read, write, and delete data, and even call functions, without writing an intermediate layer to translate between your app and Postgres.
|
||||
|
||||
## How to use the Data APIs
|
||||
## How to use the data APIs
|
||||
|
||||
The Data APIs are auto-generated HTTP REST endpoints. You can call them in the same way as any HTTP endpoint, for example, using `curl` from the command line or `fetch` from the browser. For convenience, you can use the Supabase client libraries. The client libraries perform the HTTP call for you, while also handling authentication, parsing responses, and maintaining type safety.
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ export const meta = {
|
||||
|
||||
Supabase provides client libraries for the REST and Realtime APIs. Some libraries are officially supported, and some are contributed by the community.
|
||||
|
||||
## Official Libraries
|
||||
## Official libraries
|
||||
|
||||
| `Language` | `Source Code` | `Documentation` |
|
||||
| --------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
||||
| Javascript/Typescript | [supabase-js](https://github.com/supabase/supabase-js) | [Docs](https://supabase.com/docs/reference/javascript/introduction) |
|
||||
| Dart/Flutter | [supabase-flutter](https://github.com/supabase/supabase-flutter/tree/main/packages/supabase_flutter) | [Docs](https://supabase.com/docs/reference/dart/introduction) |
|
||||
|
||||
## Community Libraries
|
||||
## Community libraries
|
||||
|
||||
| `Language` | `Source Code` | `Documentation` |
|
||||
| ----------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
||||
|
||||
@@ -84,7 +84,7 @@ import { Database } from './database.types'
|
||||
const supabase = createClient<Database>(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY)
|
||||
```
|
||||
|
||||
## Helper types for Tables and Joins
|
||||
## Helper types for tables and joins
|
||||
|
||||
You can use the following helper types to make the generated TypeScript types easier to use.
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ const { data, error } = await supabase.from('users').select('user_id, name')
|
||||
// Still => { id: 'd0714948', name: 'Jane' }
|
||||
```
|
||||
|
||||
### How It Works
|
||||
### How it works
|
||||
|
||||
1. A user signs up. Supabase creates a new user in the `auth.users` table.
|
||||
2. Supabase returns a new JWT, which contains the user's `UUID`.
|
||||
@@ -131,7 +131,7 @@ const { data, error } = await supabase.from('users').select('user_id, name')
|
||||
|
||||
Supabase provides a special function in Postgres, `auth.uid()`, which extracts the user's UID from the JWT. This is especially useful when creating policies.
|
||||
|
||||
## User Management
|
||||
## User management
|
||||
|
||||
Supabase provides multiple endpoints to authenticate and manage your users:
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ The templating system provides the following variables for use:
|
||||
|
||||
## Limitations
|
||||
|
||||
### Email Prefetching
|
||||
### Email prefetching
|
||||
|
||||
Certain email providers may have spam detection or other security features that prefetch URL links from incoming emails (e.g. [Safe Links in Microsoft Defender for Office 365](https://learn.microsoft.com/en-us/microsoft-365/security/office-365-security/safe-links-about?view=o365-worldwide)).
|
||||
In this scenario, the `{{ .ConfirmationURL }}` sent will be consumed instantly which leads to a "Token has expired or is invalid" error.
|
||||
@@ -47,7 +47,7 @@ To guard against this:
|
||||
The user should be brought to a page on your site where they can confirm the action by clicking a button.
|
||||
The button should contain the actual confirmation link which can be obtained from parsing the `confirmation_url={{ .ConfirmationURL }}` query parameter in the URL.
|
||||
|
||||
### Email Tracking
|
||||
### Email tracking
|
||||
|
||||
If you are using an external email provider that enables "email tracking", the links inside the Supabase email templates will be overwritten and won't perform as expected. We recommend disabling email tracking to ensure email links are not overwritten.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Working with server-side frameworks is slightly different to client-side framewo
|
||||
|
||||
The Auth Helpers are in `beta`. They are usable in their current state, but it's likely that there will be breaking changes.
|
||||
|
||||
## Additional Links
|
||||
## Additional links
|
||||
|
||||
- [Source code](https://github.com/supabase/auth-helpers)
|
||||
- [Known bugs and issues](https://github.com/supabase/auth-helpers/issues)
|
||||
|
||||
@@ -59,7 +59,7 @@ const App = () => (
|
||||
)
|
||||
```
|
||||
|
||||
### Social Providers
|
||||
### Social providers
|
||||
|
||||
The Auth component also supports login with [official social providers](../../auth#providers).
|
||||
|
||||
@@ -96,7 +96,7 @@ Options are available via `queryParams`:
|
||||
/>
|
||||
```
|
||||
|
||||
### Provider Scopes
|
||||
### Provider scopes
|
||||
|
||||
Provider Scopes can be requested through `providerScope`;
|
||||
|
||||
@@ -115,7 +115,7 @@ Provider Scopes can be requested through `providerScope`;
|
||||
/>
|
||||
```
|
||||
|
||||
### Supported Views
|
||||
### Supported views
|
||||
|
||||
The Auth component is currently shipped with the following views:
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ dependencies:
|
||||
supabase_auth_ui: ^0.1.0+2
|
||||
```
|
||||
|
||||
### Initialize the Flutter Auth Package
|
||||
### Initialize the Flutter Auth package
|
||||
|
||||
```dart
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -65,7 +65,7 @@ SupaEmailAuth(
|
||||
)
|
||||
```
|
||||
|
||||
### Magic Link Auth
|
||||
### Magic link Auth
|
||||
|
||||
Use SupaMagicAuth widget to create a magic link signIn form.
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
|
||||
```
|
||||
|
||||
## Basic Setup
|
||||
## Basic setup
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -114,7 +114,7 @@ export default MyApp
|
||||
|
||||
You can now determine if a user is authenticated by checking that the `user` object returned by the `useUser()` hook is defined.
|
||||
|
||||
### Code Exchange API Route
|
||||
### Code Exchange API route
|
||||
|
||||
The `Code Exchange` API route is required for the [server-side auth flow](https://supabase.com/docs/guides/auth/server-side-rendering) implemented by the Next.js Auth Helpers. It exchanges an auth `code` for the user's `session`, which is set as a cookie for future requests made to Supabase.
|
||||
|
||||
@@ -594,7 +594,7 @@ export default ProtectedRoute
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Auth with Next.js Middleware
|
||||
## Auth with Next.js middleware
|
||||
|
||||
As an alternative to protecting individual pages you can use a [Next.js Middleware](https://nextjs.org/docs/middleware) to protect the entire directory or those that match the config object. In the following example, all requests to `/middleware-protected/*` will check whether a user is signed in, if successful the request will be forwarded to the destination route, otherwise the user will be redirected:
|
||||
|
||||
@@ -631,11 +631,11 @@ export const config = {
|
||||
}
|
||||
```
|
||||
|
||||
## Migration Guide
|
||||
## Migration guide
|
||||
|
||||
### Migrating to v0.7.X
|
||||
|
||||
#### PKCE Auth Flow
|
||||
#### PKCE Auth flow
|
||||
|
||||
PKCE is the new server-side auth flow implemented by the Next.js Auth Helpers. It requires a new API route for `/api/auth/callback` that exchanges an auth `code` for the user's `session`.
|
||||
|
||||
@@ -655,7 +655,7 @@ supabase.auth.signUp({
|
||||
})
|
||||
```
|
||||
|
||||
#### Deprecated Functions
|
||||
#### Deprecated functions
|
||||
|
||||
With v0.7.x of the Next.js Auth Helpers a new naming convention has been implemented for createClient functions. The `createBrowserSupabaseClient` and `createServerSupabaseClient` functions have been marked as deprecated, and will be removed in a future version of the Auth Helpers.
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ If you are using the `pages` directory, check out [Auth Helpers in Next.js Pages
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Install Next.js Auth Helpers library
|
||||
## Install Next.js Auth helpers library
|
||||
|
||||
```sh Terminal
|
||||
npm install @supabase/auth-helpers-nextjs @supabase/supabase-js
|
||||
```
|
||||
|
||||
## Declare Environment Variables
|
||||
## Declare environment variables
|
||||
|
||||
Retrieve your project's URL and anon key from your [API settings](https://supabase.com/dashboard/project/_/settings/api), and create a `.env.local` file with the following environment variables:
|
||||
|
||||
@@ -46,7 +46,7 @@ NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
|
||||
```
|
||||
|
||||
## Managing session with Middleware
|
||||
## Managing session with middleware
|
||||
|
||||
When using the Supabase client on the server, you must perform extra steps to ensure the user's auth session remains active. Since the user's session is tracked in a cookie, we need to read this cookie and update it if necessary.
|
||||
|
||||
@@ -384,7 +384,7 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
|
||||
The combination of [Server Components](https://nextjs.org/docs/getting-started/react-essentials#server-components) and [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) can be used to trigger the authentication process from form submissions.
|
||||
|
||||
#### Sign Up Route
|
||||
#### Sign up route
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -470,7 +470,7 @@ Returning a `301` status redirects from a POST to a GET route
|
||||
|
||||
</Admonition>
|
||||
|
||||
#### Login Route
|
||||
#### Login route
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -550,7 +550,7 @@ Returning a `301` status redirects from a POST to a GET route
|
||||
|
||||
</Admonition>
|
||||
|
||||
#### Logout Route
|
||||
#### Logout route
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -612,7 +612,7 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### Login Page
|
||||
#### Login page
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -661,7 +661,7 @@ export default function Login() {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Creating a Supabase Client
|
||||
## Creating a Supabase client
|
||||
|
||||
There are 5 ways to access the Supabase client with the Next.js Auth Helpers:
|
||||
|
||||
@@ -673,7 +673,7 @@ There are 5 ways to access the Supabase client with the Next.js Auth Helpers:
|
||||
|
||||
This allows for the Supabase client to be easily instantiated in the correct context. All you need to change is the context in the middle `create[ClientComponent|ServerComponent|ServerAction|RouteHandler|Middleware]Client` and the Auth Helpers will take care of the rest.
|
||||
|
||||
### Client Components
|
||||
### Client components
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
@@ -772,7 +772,7 @@ The `createClientComponentClient` function implements a [Singleton pattern](http
|
||||
const supabase = createClientComponentClient({ isSingleton: false })
|
||||
```
|
||||
|
||||
### Server Components
|
||||
### Server components
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
@@ -845,7 +845,7 @@ Check out the [Next.js auth example repo](https://github.com/supabase/supabase/t
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Server Actions
|
||||
### Server actions
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
@@ -935,7 +935,7 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### Route Handlers
|
||||
### Route handlers
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
@@ -1004,13 +1004,13 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
|
||||
See [refreshing session example](/docs/guides/auth/auth-helpers/nextjs#managing-session-with-middleware) above.
|
||||
|
||||
### Edge Runtime
|
||||
### Edge runtime
|
||||
|
||||
The Next.js Edge Runtime allows you to host Server Components and Route Handlers from Edge nodes, serving the routes as close as possible to your user's location.
|
||||
|
||||
A route can be configured to use the Edge Runtime by exporting a `runtime` variable set to `edge`. Additionally, the `cookies()` function must be called from the Edge route, before creating a Supabase Client.
|
||||
|
||||
#### Server Components
|
||||
#### Server components
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1074,7 +1074,7 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### Route Handlers
|
||||
#### Route handlers
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1139,11 +1139,11 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### Static Routes
|
||||
### Static routes
|
||||
|
||||
Server Components and Route Handlers are static by default - data is fetched once at build time and the value is cached. Since the request to Supabase now happens at build time, there is no user, session or cookie to pass along with the request to Supabase. Therefore, the `createClient` function from `supabase-js` can be used to fetch data for static routes.
|
||||
|
||||
#### Server Components
|
||||
#### Server components
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1197,7 +1197,7 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### Route Handlers
|
||||
#### Route handlers
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1266,11 +1266,11 @@ TypeScript types can be [generated with the Supabase CLI](/docs/reference/javasc
|
||||
- [Protected Routes](https://github.com/supabase/supabase/tree/master/examples/auth/nextjs/app/[id]/page.tsx)
|
||||
- [Conditional Rendering in Client Components with SSR](https://github.com/supabase/supabase/tree/master/examples/auth/nextjs/app/login-form.tsx)
|
||||
|
||||
## Migration Guide
|
||||
## Migration guide
|
||||
|
||||
### Migrating to v0.7.X
|
||||
|
||||
#### PKCE Auth Flow
|
||||
#### PKCE Auth flow
|
||||
|
||||
PKCE is the new server-side auth flow implemented by the Next.js Auth Helpers. It requires a new Route Handler for `/auth/callback` that exchanges an auth `code` for the user's `session`.
|
||||
|
||||
@@ -1290,7 +1290,7 @@ supabase.auth.signUp({
|
||||
})
|
||||
```
|
||||
|
||||
#### Deprecated Functions
|
||||
#### Deprecated functions
|
||||
|
||||
With v0.7.x of the Next.js Auth Helpers a new naming convention has been implemented for createClient functions. The `createMiddlewareSupabaseClient`, `createBrowserSupabaseClient`, `createServerComponentSupabaseClient` and `createRouteHandlerSupabaseClient` functions have been marked as deprecated, and will be removed in a future version of the Auth Helpers.
|
||||
|
||||
@@ -1299,7 +1299,7 @@ With v0.7.x of the Next.js Auth Helpers a new naming convention has been impleme
|
||||
- `createServerComponentSupabaseClient` has been replaced with `createServerComponentClient`
|
||||
- `createRouteHandlerSupabaseClient` has been replaced with `createRouteHandlerClient`
|
||||
|
||||
#### createClientComponentClient returns singleton
|
||||
#### `createClientComponentClient` returns singleton
|
||||
|
||||
You no longer need to implement logic to ensure there is only a single instance of the Supabase Client shared across all Client Components - this is now the default and handled by the `createClientComponentClient` function. Call it as many times as you want!
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ SUPABASE_URL=YOUR_SUPABASE_URL
|
||||
SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
|
||||
```
|
||||
|
||||
### Code Exchange Route
|
||||
### Code Exchange route
|
||||
|
||||
The `Code Exchange` route is required for the [server-side auth flow](https://supabase.com/docs/guides/auth/server-side-rendering) implemented by the Remix Auth Helpers. It exchanges an auth `code` for the user's `session`, which is set as a cookie for future requests made to Supabase.
|
||||
|
||||
@@ -275,7 +275,7 @@ export const action = async ({ request }: ActionArgs) => {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Session and User
|
||||
## Session and user
|
||||
|
||||
You can determine if a user is authenticated by checking their session using the `getSession` function.
|
||||
|
||||
@@ -759,11 +759,11 @@ export default function Index() {
|
||||
|
||||
> Ensure you have [enabled replication](https://supabase.com/dashboard/project/_/database/replication) on the table you are subscribing to.
|
||||
|
||||
## Migration Guide
|
||||
## Migration guide
|
||||
|
||||
### Migrating to v0.2.0
|
||||
|
||||
#### PKCE Auth Flow
|
||||
#### PKCE Auth flow
|
||||
|
||||
PKCE is the new server-side auth flow implemented by the Remix Auth Helpers. It requires a new `loader` route for `/auth/callback` that exchanges an auth `code` for the user's `session`.
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ This submodule provides convenience helpers for implementing user authentication
|
||||
|
||||
## Configuration
|
||||
|
||||
### Install SvelteKit Auth Helpers library
|
||||
### Install SvelteKit Auth helpers library
|
||||
|
||||
This library supports Node.js `^16.15.0`.
|
||||
|
||||
@@ -25,7 +25,7 @@ This library supports Node.js `^16.15.0`.
|
||||
npm install @supabase/auth-helpers-sveltekit @supabase/supabase-js
|
||||
```
|
||||
|
||||
### Declare Environment Variables
|
||||
### Declare environment variables
|
||||
|
||||
Retrieve your project's URL and anon key from your [API settings](https://supabase.com/dashboard/project/_/settings/api), and create a `.env.local` file with the following environment variables:
|
||||
|
||||
@@ -35,7 +35,7 @@ PUBLIC_SUPABASE_URL=https://your-project.supabase.co
|
||||
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
|
||||
```
|
||||
|
||||
### Creating a Supabase Client
|
||||
### Creating a Supabase client
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -128,7 +128,7 @@ Note that we are specifying filterSerializedResponseHeaders here. We need to tel
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Code Exchange Route
|
||||
### Code Exchange route
|
||||
|
||||
The `Code Exchange` route is required for the [server-side auth flow](https://supabase.com/docs/guides/auth/server-side-rendering) implemented by the SvelteKit Auth Helpers. It exchanges an auth `code` for the user's `session`, which is set as a cookie for future requests made to Supabase.
|
||||
|
||||
@@ -254,7 +254,7 @@ export const load = async ({ locals: { getSession } }) => {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### Shared Load functions and pages
|
||||
#### Shared load functions and pages
|
||||
|
||||
To utilize Supabase in shared load functions and within pages, it is essential to create a Supabase client in the root layout load.
|
||||
|
||||
@@ -366,7 +366,7 @@ We need to create an event listener in the root `+layout.svelte` file in order t
|
||||
|
||||
The usage of `invalidate` tells SvelteKit that the root `+layout.ts` load function should be executed whenever the session updates to keep the page store in sync.
|
||||
|
||||
#### Sign in / Sign up / Sign out
|
||||
#### Sign in / sign up / sign out
|
||||
|
||||
We can access the supabase instance in our `+page.svelte` file through the data object.
|
||||
|
||||
@@ -544,7 +544,7 @@ export const GET = async ({ locals: { supabase, getSession } }) => {
|
||||
|
||||
If you visit `/api/protected-route` without a valid session cookie, you will get a 401 response.
|
||||
|
||||
### Protecting Actions
|
||||
### Protecting actions
|
||||
|
||||
Wrap an Action to check that the user has a valid session. If they're not logged in the session is `null`.
|
||||
|
||||
@@ -827,11 +827,11 @@ export const actions = {
|
||||
}
|
||||
```
|
||||
|
||||
## Migration Guide [#migration]
|
||||
## Migration guide [#migration]
|
||||
|
||||
### Migrate to 0.10
|
||||
|
||||
#### PKCE Auth Flow
|
||||
#### PKCE Auth flow
|
||||
|
||||
Proof Key for Code Exchange (PKCE) is the new server-side auth flow implemented by the SvelteKit Auth Helpers. It requires a server endpoint for `/auth/callback` that exchanges an auth `code` for the user's `session`.
|
||||
|
||||
@@ -1422,7 +1422,7 @@ declare namespace App {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### withPageAuth [#migration-with-page-auth-0-8]
|
||||
#### `withPageAuth` [#migration-with-page-auth-0-8]
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1501,7 +1501,7 @@ export const load: PageLoad = async (event) => {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### withApiAuth [#migration-with-api-auth-0-8]
|
||||
#### `withApiAuth` [#migration-with-api-auth-0-8]
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1818,7 +1818,7 @@ declare namespace App {
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### withPageAuth
|
||||
#### `withPageAuth`
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1895,7 +1895,7 @@ export const load: PageLoad = withAuth(async ({ session, getSupabaseClient }) =>
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
#### withApiAuth
|
||||
#### `withApiAuth`
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -1960,7 +1960,7 @@ export const GET: RequestHandler = withAuth(async ({ session, getSupabaseClient
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Additional Links
|
||||
## Additional links
|
||||
|
||||
- [Auth Helpers Source code](https://github.com/supabase/auth-helpers)
|
||||
- [SvelteKit example](https://github.com/supabase/auth-helpers/tree/main/examples/sveltekit)
|
||||
|
||||
@@ -31,9 +31,9 @@ You can use hooks at specific points along an Auth flow to perform custom behavi
|
||||
|
||||
You can connect a hook to Supabase Auth to signal to Supabase Auth that it should make use of the hook.
|
||||
|
||||
## Create a Hook
|
||||
## Create a hook
|
||||
|
||||
### What is a Hook
|
||||
### What is a hook
|
||||
|
||||
A hook is a [Postgres Function](https://www.postgresql.org/docs/current/sql-createfunction.html) with a single argument -- the `event` of type [JSONB]() -- and which returns a JSONB object.
|
||||
|
||||
@@ -124,11 +124,11 @@ When an error is returned, the error is propagated from the hook to Supabase Aut
|
||||
|
||||
Ensure that your hooks complete within **2 seconds** to avoid any errors.
|
||||
|
||||
### Connect a Hook
|
||||
### Connect a hook
|
||||
|
||||
In the dashboard, navigate to [`Authentication > Hooks (Beta)`](/dashboard/project/_/auth/hooks) and select the appropriate PostgreSQL function from the dropdown menu.
|
||||
|
||||
## Hook: MFA Verification Attempt
|
||||
## Hook: MFA verification attempt
|
||||
|
||||
You can add additional checks to the [Supabase MFA implementation](/docs/guides/auth/auth-mfa) with hooks. For example, you can:
|
||||
|
||||
@@ -268,7 +268,7 @@ revoke all
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Hook: Password Verification Attempt
|
||||
## Hook: Password verification attempt
|
||||
|
||||
Your company wishes to increase security beyond the requirements of the default password implementation in order to fulfill security or compliance requirements. You plan to track the status of a password sign-in attempt and take action via an email or a restriction on logins where necessary.
|
||||
|
||||
@@ -513,7 +513,7 @@ revoke all
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Hook: Custom Access Token
|
||||
## Hook: Custom access token
|
||||
|
||||
The custom access token hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export const meta = {
|
||||
subtitle: 'Manage the identities associated with your user',
|
||||
}
|
||||
|
||||
## The User Identity
|
||||
## The user identity
|
||||
|
||||
The user identity represents an authentication method associated to the user. For example, if a user signs in using their email, an email identity will be associated with the user.
|
||||
|
||||
@@ -39,7 +39,7 @@ In order for automatic linking to correctly identify the user for linking, Supab
|
||||
|
||||
Users that signed up with [SAML SSO](/docs/guides/auth/sso/auth-sso-saml) will not be considered as targets for automatic linking.
|
||||
|
||||
### Manual linking (Beta)
|
||||
### Manual linking (beta)
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
|
||||
@@ -53,7 +53,7 @@ If you are on one of the Kotlin targets that have built-in support for redirect
|
||||
|
||||
The email link you receive will work like a magic link. This way when you click the link you will be logged into the website. Since we passed a redirect URL to the [`.resetPasswordForEmail`](https://supabase.com/docs/reference/javascript/auth-resetpasswordforemail) method the user should be sent to the update password page.
|
||||
|
||||
### Update Password
|
||||
### Update password
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
@@ -214,7 +214,7 @@ That's it! `supabase-kt` will take care of parsing and importing the session. Ot
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### Update Password
|
||||
### Update password
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
|
||||
@@ -19,7 +19,7 @@ Beyond rate limits, an SMTP server might also help with:
|
||||
- Analytics and Tracking
|
||||
- Compliance and Anti Spam measures
|
||||
|
||||
## How to Set up SMTP
|
||||
## How to set up SMTP
|
||||
|
||||
Head over to [Auth Settings Page](https://supabase.com/dashboard/project/_/settings/auth) and hit "Enable Custom SMTP" under the SMTP Provider section.
|
||||
|
||||
@@ -27,11 +27,11 @@ Fill in fields below with the relevant details obtained from your custom SMTP pr
|
||||
|
||||

|
||||
|
||||
## How to update Email Rate Limits
|
||||
## How to update email rate limits
|
||||
|
||||
After adding a custom SMTP provider, you can head over to [Auth > Rate Limits](https://supabase.com/dashboard/project/_/auth/rate-limits) to configure the rate limits for sending emails.
|
||||
|
||||
### SMTP Providers
|
||||
### SMTP providers
|
||||
|
||||
You can use Supabase Auth with any major SMTP provider of your choosing. Some SMTP providers you could consider using are:
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export const meta = {
|
||||
subtitle: 'Manage your users with Supabase Auth',
|
||||
}
|
||||
|
||||
## The User Object
|
||||
## The user object
|
||||
|
||||
The user object stores all the information related to a user in your application. The user object can be retrieved using one of these methods:
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Primary keys are **guaranteed not to change**. Columns, indices, constraints or
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Deleting Users
|
||||
## Deleting users
|
||||
|
||||
You may delete users directly or via the management console at Authentication > Users. Note that deleting a user from the `auth.users` table does not automatically sign out a user. As Supabase makes use of JSON Web Tokens (JWT), a user's JWT will remain "valid" until it has expired. Should you wish to immediately revoke access for a user, do consider making use of a Row Level Security policy as described below.
|
||||
|
||||
@@ -46,7 +46,7 @@ You will encounter an error when you try to delete an Auth user that owns any St
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Exporting Users
|
||||
## Exporting users
|
||||
|
||||
As Supabase is built on top of PostgreSQL, you can query the `auth.users` and `auth.identities` table via the `SQL Editor` tab to extract all users:
|
||||
|
||||
@@ -139,7 +139,7 @@ If you need to fetch a full list of user profiles, we supply a `service_key` whi
|
||||
|
||||
Make sure you _NEVER_ expose this publicly. But it can be used on the server-side to fetch all of the profiles.
|
||||
|
||||
## Accessing User Metadata
|
||||
## Accessing user metadata
|
||||
|
||||
You can assign metadata to users on sign up:
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ There are several reasons why you might want to add social login to your applica
|
||||
|
||||
</div>
|
||||
|
||||
## Provider Tokens
|
||||
## Provider tokens
|
||||
|
||||
Just like with Oauth, you will receive a copy of the provider token in case you need to use it further. For example, you can use the Google provider token to access Google APIs on behalf of your user.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const meta = {
|
||||
|
||||
Email one-time passwords (OTP) are a form of passwordless login where users key in a six digit code sent to their email address to log in to their accounts. By default, a user can only request an OTP once every 60 seconds and they expire after 24 hours.
|
||||
|
||||
## Setting up Email OTP
|
||||
## Setting up email OTP
|
||||
|
||||
To set up email OTP for your Supabase app:
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ and the response should also be the same as above:
|
||||
|
||||
The user does not have a password therefore will need to sign in via this method each time they want to access your service.
|
||||
|
||||
## WhatsApp OTP Logins
|
||||
## WhatsApp OTP logins
|
||||
|
||||
In some cases, you may wish to use WhatsApp as a delivery channel instead. Here are some examples our users have cited:
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ using ( true );
|
||||
```
|
||||
|
||||
|
||||
## Helper Functions
|
||||
## Helper functions
|
||||
|
||||
Supabase provides some helper functions that make it easier to write Policies.
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ Even though refresh tokens are long-lived, there is no guarantee that a user has
|
||||
|
||||
A good practice is to handle unauthorized errors by deferring rendering the page in the browser instead of in the server. Some user information is contained in the access token though, so in certain cases, you may be able to use this potentially stale information to render a page.
|
||||
|
||||
## Frequently Asked Questions
|
||||
## Frequently asked questions
|
||||
|
||||
### No session on the server side with Next.js route prefetching?
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
When using Supabase with server-side languages and frameworks - such as Next.js, SvelteKit and Remix - it is important to configure your Supabase client to use cookies for storing user sessions. We have developed an `@supabase/ssr` package to make this process as simple as possible. This package is currently in `beta`. Adoption is recommended but be aware that the API is still unstable and may have breaking changes in the future.
|
||||
|
||||
## Framework Quickstarts
|
||||
## Framework quickstarts
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{quickstarts.map((item) => {
|
||||
|
||||
@@ -42,7 +42,7 @@ Supabase supports a suite of social providers. Follow these guides to configure
|
||||
|
||||
</div>
|
||||
|
||||
## Provider Tokens
|
||||
## Provider tokens
|
||||
|
||||
You can use the provider token and provider refresh token returned to make API calls to the OAuth provider. For example, you can use the Google provider token to access Google APIs on behalf of your user.
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app,
|
||||
|
||||
<AppleSecretGenerator />
|
||||
|
||||
## Using Sign in with Apple JS
|
||||
## Using sign in with Apple JS
|
||||
|
||||
[Sign in with Apple JS](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js) is an official Apple framework for authenticating Apple users on websites. Although it can be used in web-based apps, those use cases will benefit more with the OAuth flow described above. We recommend using this method on classic websites only.
|
||||
|
||||
@@ -120,7 +120,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app,
|
||||
|
||||
<TabPanel id="react-native" label="Expo React Native">
|
||||
|
||||
## Using Native Sign in with Apple in Expo
|
||||
## Using native sign in with Apple in Expo
|
||||
|
||||
When working with Expo, you can use the [Expo AppleAuthentication](https://docs.expo.dev/versions/latest/sdk/apple-authentication/) library to obtain and ID token that you can pass to supabase-js [`signInWithIdToken` method](/docs/reference/javascript/auth-signinwithidtoken).
|
||||
|
||||
@@ -200,7 +200,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app,
|
||||
|
||||
<TabPanel id="flutter" label="Flutter">
|
||||
|
||||
## Using Native Sign in with Apple in Flutter
|
||||
## Using native sign in with Apple in Flutter
|
||||
|
||||
You can perform Apple sign in using the [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) package on Flutter.
|
||||
Follow the instructions in the package README to set up native Apple sign in on iOS and macOS.
|
||||
@@ -253,7 +253,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app,
|
||||
|
||||
<TabPanel id="swift" label="Swift">
|
||||
|
||||
## Using Native Sign in with Apple in Swift
|
||||
## Using native sign in with Apple in Swift
|
||||
|
||||
For apps written in Swift, follow the [Apple Developer docs](https://developer.apple.com/documentation/sign_in_with_apple/implementing_user_authentication_with_sign_in_with_apple) for obtaining the ID token and then pass it to the [Swift client's `signInWithIdToken`](https://github.com/supabase-community/gotrue-swift/blob/main/Examples/Shared/Sources/SignInWithAppleView.swift#L36) method.
|
||||
|
||||
@@ -313,7 +313,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app,
|
||||
|
||||
<TabPanel id="kotlin" label="Kotlin">
|
||||
|
||||
## Using Native Sign in with Apple in Kotlin
|
||||
## Using native sign in with Apple in Kotlin
|
||||
|
||||
When using [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform/), you can use the [compose-auth](https://supabase.com/docs/reference/kotlin/installing) plugin. On iOS it uses Native Apple Login automatically and on other platforms it uses `gotrue.signInWith(Apple)`.
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Setting up OAuth with Azure consists of four broad steps:
|
||||
|
||||

|
||||
|
||||
## Obtain a Client ID and Secret
|
||||
## Obtain a client ID and secret
|
||||
|
||||
- Once your app has been registered, the client ID can be found under the [list of app registrations](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) under the column titled _Application (client) ID_.
|
||||
- You can also find it in the app overview screen.
|
||||
@@ -46,7 +46,7 @@ Setting up OAuth with Azure consists of four broad steps:
|
||||
|
||||

|
||||
|
||||
## Guarding Against Unverified Email Domains
|
||||
## Guarding against unverified email domains
|
||||
|
||||
Microsoft Entra ID can send out unverified email domains in certain cases. This may open up your project to a vulnerability where a malicious user can impersonate already existing accounts on your project.
|
||||
|
||||
@@ -97,7 +97,7 @@ Configure this in the following way:
|
||||
```
|
||||
- Select _Save_ to apply the new configuration.
|
||||
|
||||
## Configure a Tenant URL (Optional)
|
||||
## Configure a tenant URL (optional)
|
||||
|
||||
A Microsoft Entra tenant is the directory of users who are allowed to access your project. This section depends on what your OAuth registration uses for _Supported account types._
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Setting up Bitbucket logins for your application consists of 3 parts:
|
||||
- Click on your app name (the name of your new OAuth Consumer)
|
||||
- Copy your `Key` (`client_key`) and `Secret` (`client_secret`) codes
|
||||
|
||||
## Add your Bitbucket credentials into your Supabase Project
|
||||
## Add your Bitbucket credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Bitbucket" />
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Setting up Discord logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="Discord" />
|
||||
|
||||
## Create a Discord Application
|
||||
## Create a Discord application
|
||||
|
||||
- Click on `New Application` at the top right.
|
||||
- Enter the name of your application and click `Create`.
|
||||
@@ -41,7 +41,7 @@ Setting up Discord logins for your application consists of 3 parts:
|
||||
- Click `Save Changes` at the bottom.
|
||||
- Copy your `Client ID` and `Client Secret` under `Client information`.
|
||||
|
||||
## Add your Discord credentials into your Supabase Project
|
||||
## Add your Discord credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Discord" />
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Setting up Facebook logins for your application consists of 3 parts:
|
||||
|
||||

|
||||
|
||||
## Create a Facebook App
|
||||
## Create a Facebook app
|
||||
|
||||
- Click on `My Apps` at the top right.
|
||||
- Click `Create App` near the top right.
|
||||
@@ -33,7 +33,7 @@ Setting up Facebook logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="Facebook" />
|
||||
|
||||
## Set up Facebook Login for your Facebook App
|
||||
## Set up Facebook login for your Facebook app
|
||||
|
||||
From the `Add Products to your App` screen:
|
||||
|
||||
@@ -51,14 +51,14 @@ Under `Build Your App`, click on `Use Cases` screen. From there, do the followin
|
||||
- `public_profile` is set by default, so make sure it and `email` have status of **Ready for testing** in the redirected page.
|
||||
- If not, click the **Add** button in email on right side.
|
||||
|
||||
## Copy your Facebook App ID and Secret
|
||||
## Copy your Facebook app ID and secret
|
||||
|
||||
- Click `Settings / Basic` in the left sidebar
|
||||
- Copy your App ID from the top of the `Basic Settings` page
|
||||
- Under `App Secret` click `Show` then copy your secret
|
||||
- Make sure all required fields are completed on this screen.
|
||||
|
||||
## Enter your Facebook App ID and Secret into your Supabase Project
|
||||
## Enter your Facebook app ID and secret into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Facebook" />
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Setting up Figma logins for your application consists of 3 parts:
|
||||
|
||||

|
||||
|
||||
## Enter your Figma credentials into your Supabase Project
|
||||
## Enter your Figma credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Figma" />
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Setting up GitHub logins for your application consists of 3 parts:
|
||||
|
||||

|
||||
|
||||
## Create a GitHub Oauth App
|
||||
## Create a GitHub OAuth app
|
||||
|
||||
Go to the [GitHub Developer Settings](https://github.com/settings/developers) page:
|
||||
|
||||
@@ -36,7 +36,7 @@ Go to the [GitHub Developer Settings](https://github.com/settings/developers) pa
|
||||
|
||||
<SocialProviderSetup provider="GitHub" />
|
||||
|
||||
## Register a new OAuth application on Github.
|
||||
## Register a new OAuth application on GitHub
|
||||
|
||||
- Navigate to `Settings`/`Developer settings`/`OAuth Apps`
|
||||
- Click `Register a new application`. If you've created an app before, click `New OAuth App` here.
|
||||
@@ -53,7 +53,7 @@ Copy your new OAuth credentials
|
||||
- Click `Generate a new client secret`.
|
||||
- Copy and save your `Client secret`.
|
||||
|
||||
## Enter your GitHub credentials into your Supabase Project
|
||||
## Enter your GitHub credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="GitHub" />
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Setting up GitLab logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="GitLab" />
|
||||
|
||||
## Create your GitLab Application
|
||||
## Create your GitLab application
|
||||
|
||||
- Click on your `profile logo` (avatar) in the top-right corner.
|
||||
- Select `Edit profile`.
|
||||
@@ -39,7 +39,7 @@ Setting up GitLab logins for your application consists of 3 parts:
|
||||
- Click `Save Application` at the bottom.
|
||||
- Copy and save your `Application ID` (`client_id`) and `Secret` (`client_secret`) which you'll need later.
|
||||
|
||||
## Add your GitLab credentials into your Supabase Project
|
||||
## Add your GitLab credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="GitLab" />
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Before you can use Sign in with Google, you need to obtain a [Google Cloud Platf
|
||||
2. Configure the [OAuth Consent Screen](https://console.cloud.google.com/apis/credentials/consent). This information is shown to the user when giving consent to your app. Within _Authorized domains_ make sure you add your Supabase project's domain `<project-id>.supabase.co`. Configure the non-sensitive scopes by making sure the following ones are selected: `.../auth/userinfo.email`, `.../auth/userinfo.profile`, `openid`. If you're selecting other sensitive scopes, your app may require additional verification. In those cases, it's best to use [custom domains](/docs/guides/platform/custom-domains).
|
||||
3. Finally, add the client ID and secret from step 1 in the [Google provider on the Supabase Dashboard](https://supabase.com/dashboard/project/_/auth/providers).
|
||||
|
||||
## Using personalized sign-in buttons, One Tap or automatic sign-in
|
||||
## Using personalized sign-in buttons, one-tap or automatic signin
|
||||
|
||||
Most web apps and websites can utilize Google's [personalized sign-in buttons](https://developers.google.com/identity/gsi/web/guides/personalized-button), [One Tap](https://developers.google.com/identity/gsi/web/guides/features) or [automatic sign-in](https://developers.google.com/identity/gsi/web/guides/automatic-sign-in-sign-out) for the best user experience.
|
||||
|
||||
@@ -120,7 +120,7 @@ Before you can use Sign in with Google, you need to obtain a [Google Cloud Platf
|
||||
|
||||
Use of nonce is recommended, though optional. Make sure each nonce is generated randomly and available both in the `data-nonce` attribute as well as in the `handleSignInWithGoogle` callback function; otherwise the ID token will not be accepted.
|
||||
|
||||
### Important Note on Nonce Validation
|
||||
### Important note on nonce validation
|
||||
|
||||
Supabase Auth expects the nonce in Google's ID token to be hashed (specifically with SHA-256 and represented as a hexadecimal string).
|
||||
|
||||
@@ -160,7 +160,7 @@ Before you can use Sign in with Google, you need to obtain a [Google Cloud Platf
|
||||
|
||||
<TabPanel id="react-native" label="Expo React Native">
|
||||
|
||||
## Using Native Sign in with Google in Expo
|
||||
## Using native sign in with Google in Expo
|
||||
|
||||
Unlike the OAuth flow which requires the use of a web browser, the native Sign in with Google flow on Android uses the [operating system's built-in functionalities](https://developers.google.com/android/reference/com/google/android/gms/auth/api/identity/package-summary) to prompt the user for consent. Note that native sign-in has been rebranded as _One Tap sign-in on Android_ by Google, which you should not confuse with _One Tap sign in for web_, as mentioned below.
|
||||
|
||||
@@ -234,7 +234,7 @@ Before you can use Sign in with Google, you need to obtain a [Google Cloud Platf
|
||||
|
||||
<TabPanel id="flutter" label="Flutter">
|
||||
|
||||
## Using Native Sign in with Google in Flutter
|
||||
## Using native sign in with Google in Flutter
|
||||
|
||||
Native Google sign in with Supabase is done through the [google_sign_in](https://pub.dev/packages/google_sign_in) package for iOS and Android. Follow the instructions on the [google_sign_in](https://pub.dev/packages/google_sign_in) package for plugin specific settings.
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ This will serve as the `client_id` when you make API calls to authenticate the u
|
||||
- Click on `generate code` at the bottom to generate the `Client secret code` -- this will serve as a `client_secret` for your supabase project.
|
||||
- Make sure you enabled `Client secret code` by selecting `enable` from the `Activation state` section.
|
||||
|
||||
## Additional configurations on Kakao Developers Portal
|
||||
## Additional configurations on Kakao Developers portal
|
||||
|
||||
- Make sure the Kakao Login is enabled in the `Kakao Login` tab.
|
||||
- Set following scopes under the "Consent Items": account_email, profile_image, profile_nickname
|
||||
|
||||
@@ -23,11 +23,11 @@ Keycloak OAuth consists of five broad steps:
|
||||
- Obtain the `Secret` from the credentials tab which will be used as the `client secret`.
|
||||
- Add the callback url of your application to your allowlist.
|
||||
|
||||
## Access your Keycloak Admin console
|
||||
## Access your Keycloak admin console
|
||||
|
||||
- Login by visiting [`http://localhost:8080`](http://localhost:8080) and clicking on "Administration Console".
|
||||
|
||||
## Create a Keycloak Realm
|
||||
## Create a Keycloak realm
|
||||
|
||||
- Once you've logged in to the Keycloak console, you can add a realm from the side panel. The default realm should be named "Master".
|
||||
- After you've added a new realm, you can retrieve the `issuer` from the "OpenID Endpoint Configuration" endpoint. The `issuer` will be used as the `Keycloak URL`.
|
||||
@@ -35,13 +35,13 @@ Keycloak OAuth consists of five broad steps:
|
||||
|
||||

|
||||
|
||||
## Create a Keycloak Client
|
||||
## Create a Keycloak client
|
||||
|
||||
The "Client ID" of the created client will serve as the `client_id` when you make API calls to authenticate the user.
|
||||
|
||||

|
||||
|
||||
## Client Settings
|
||||
## Client settings
|
||||
|
||||
After you've created the client successfully, ensure that you set the following settings:
|
||||
|
||||
@@ -52,7 +52,7 @@ After you've created the client successfully, ensure that you set the following
|
||||

|
||||

|
||||
|
||||
## Obtain the Client Secret
|
||||
## Obtain the client secret
|
||||
|
||||
This will serve as the `client_secret` when you make API calls to authenticate the user.
|
||||
Under the "Credentials" tab, the `Secret` value will be used as the `client secret`.
|
||||
|
||||
@@ -50,7 +50,7 @@ Ensure that the appropriate scopes have been added under OAuth 2.0 Scopes at the
|
||||
|
||||

|
||||
|
||||
## Enter your LinkedIn (OIDC) credentials into your Supabase Project
|
||||
## Enter your LinkedIn (OIDC) credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="LinkedIn (OIDC)" />
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Setting up Notion logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="Notion" />
|
||||
|
||||
## Add your Notion credentials into your Supabase Project
|
||||
## Add your Notion credentials into your Supabase project
|
||||
|
||||
- Once you've created your notion integration, you should be able to retrieve the "OAuth client ID" and "OAuth client secret" from the "OAuth Domain and URIs" tab.
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ Under `Scopes`:
|
||||
|
||||
- Add the following scopes under the `User Token Scopes`: `profile`, `email`, `openid`. These scopes are the default scopes that Supabase Auth uses to request for user information. You can add any additional scopes that you may need as well.
|
||||
|
||||
## Enter your Slack credentials into your Supabase Project
|
||||
## Enter your Slack credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Slack" />
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Under `Redirect URIs`:
|
||||
- Click `Add`
|
||||
- Click `Save` at the bottom
|
||||
|
||||
## Enter your Spotify credentials into your Supabase Project
|
||||
## Enter your Spotify credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Spotify" />
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Setting up Twitch logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="Twitch" />
|
||||
|
||||
## Create a Twitch Application
|
||||
## Create a Twitch application
|
||||
|
||||

|
||||
|
||||
@@ -45,7 +45,7 @@ Setting up Twitch logins for your application consists of 3 parts:
|
||||
- Select a category for your app.
|
||||
- Check the Captcha box and click `Create`.
|
||||
|
||||
## Retrieve your Twitch OAuth Client ID and Client Secret
|
||||
## Retrieve your Twitch OAuth client ID and client secret
|
||||
|
||||
- Click `Manage` at the right of your application entry in the list.
|
||||
|
||||
@@ -57,7 +57,7 @@ Setting up Twitch logins for your application consists of 3 parts:
|
||||
|
||||

|
||||
|
||||
## Add your Twitch credentials into your Supabase Project
|
||||
## Add your Twitch credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Twitch" />
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Setting up Twitter logins for your application consists of 3 parts:
|
||||
- Enter your `Privacy policy URL`.
|
||||
- Click `Save`.
|
||||
|
||||
## Enter your Twitter credentials into your Supabase Project
|
||||
## Enter your Twitter credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Twitter" />
|
||||
|
||||
|
||||
@@ -20,25 +20,25 @@ The procedure consists of five broad steps:
|
||||
- Connect a WorkOS Supported Identity Provider
|
||||
- Add your WorkOS credentials into your Supabase project
|
||||
|
||||
## Create a WorkOS Organization
|
||||
## Create a WorkOS organization
|
||||
|
||||
Log in to the dashboard and hop over to the Organizations tab to create and organization
|
||||

|
||||
|
||||
## Obtain the Client ID and configure Redirect URI
|
||||
## Obtain the client ID and configure redirect URI
|
||||
|
||||
Head over to the Configuration tab and configure the redirect URI.The redirect URI should look like `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
Note that this is distinct from the redirect URI referred to in the Supabase dashboard
|
||||
|
||||

|
||||
|
||||
## Obtain the WorkOS Secret
|
||||
## Obtain the WorkOS secret
|
||||
|
||||
Head over to the API Keys page and obtain the secret key.
|
||||
|
||||

|
||||
|
||||
## Connect a WorkOS Supported Identity Provider
|
||||
## Connect a WorkOS supported identity provider
|
||||
|
||||
Set up the identity provider by visiting the setup link.
|
||||
|
||||
@@ -46,7 +46,7 @@ Set up the identity provider by visiting the setup link.
|
||||
|
||||
You can pick between any one of the many identity providers that WorkOS supports.
|
||||
|
||||
## Add your WorkOS credentials into your Supabase Project
|
||||
## Add your WorkOS credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="WorkOS" />
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Setting up Zoom logins for your application consists of 3 parts:
|
||||
|
||||
<SocialProviderSetup provider="Zoom" />
|
||||
|
||||
## Create a Zoom Oauth App
|
||||
## Create a Zoom OAuth app
|
||||
|
||||
- Go to [marketplace.zoom.us](https://marketplace.zoom.us/).
|
||||
- Click on `Sign In` at the top right to log in.
|
||||
@@ -55,7 +55,7 @@ Under `Scopes`
|
||||
- Click `Done`
|
||||
- Click `Continue`
|
||||
|
||||
## Enter your Zoom credentials into your Supabase Project
|
||||
## Enter your Zoom credentials into your Supabase project
|
||||
|
||||
<SocialProviderSettingsSupabase provider="Zoom" />
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ supabase sso show <provider-id> --project-ref <your-project>
|
||||
|
||||
You can use the `-o json` flag to output the information as JSON, should you need to. Other formats may be supported, please use `--help` to see all available options.
|
||||
|
||||
## Frequently Asked Questions
|
||||
## Frequently asked questions
|
||||
|
||||
### How do I publish my application to an identity provider's marketplace?
|
||||
|
||||
@@ -374,7 +374,7 @@ Please refer to the relevant documentation for each cloud-based identity provide
|
||||
- [Azure Active Directory App Gallery](https://learn.microsoft.com/en-us/azure/active-directory-b2c/publish-app-to-azure-ad-app-gallery)
|
||||
- [Google Workspaces Pre-integrated SAML apps catalog](https://support.google.com/a/table/9217027)
|
||||
|
||||
### Why do some users get: SAML Assertion does not contain email address?
|
||||
### Why do some users get: SAML assertion does not contain email address?
|
||||
|
||||
Identity providers do not have to send back and email address for the user, though they often do. Supabase Auth requires that an email address is present.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
You can customize the email templates for local development [using the `config.toml` settings](/docs/guides/cli/config#auth-config).
|
||||
|
||||
## Configuring Templates
|
||||
## Configuring templates
|
||||
|
||||
You should provide a relative URL to the `content_path` parameter, pointing to an HTML file which contains the template. For example
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ If you have additional triggers or RLS policies defined on your `auth` schema, y
|
||||
supabase db pull --schema auth
|
||||
```
|
||||
|
||||
### Sync Storage buckets
|
||||
### Sync storage buckets
|
||||
|
||||
Your RLS policies on storage buckets can be pulled locally by specifying `storage` schema. For example,
|
||||
|
||||
@@ -461,7 +461,7 @@ supabase db pull --schema storage
|
||||
|
||||
The buckets and objects themselves are rows in the storage schema so they won't be pulled automatically.
|
||||
|
||||
### Local Logging
|
||||
### Local logging
|
||||
|
||||
Local logs rely on the Supabase Analytics Server, and are available in the Studio automatically.
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ The Supabase CLI uses [Inbucket](https://github.com/inbucket/inbucket) to captur
|
||||
|
||||
By default, Inbucket is available at [localhost:54324](http://localhost:54324) when you run `supabase start`. Simply open this URL in your browser to view the emails.
|
||||
|
||||
### Going into Production
|
||||
### Going into production
|
||||
|
||||
The "default" email provided by Supabase is only for development purposes. It is [heavily restricted](/docs/guides/platform/going-into-prod#auth-rate-limits) to ensure that it is not used for spam. Before going into production, you must configure your own email provider. This is as simple as enabling a new SMTP credentials in your [project settings](https://supabase.com/dashboard/project/_/settings/auth).
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Every Supabase project provides a full Postgres database. You can connect to the
|
||||
/>
|
||||
</video>
|
||||
|
||||
## Connection Pooler
|
||||
## Connection pooler
|
||||
|
||||
Every Supabase project comes with a connection pooler for managing connections to your Postgres database. A connection pooler is useful for managing a large number of _temporary_ connections - for example, if you are using Prisma, Drizzle, Kysely, or anything deployed to a Serverless environment (AWS Lambdas or Edge Functions). You can find the connection pool config in the [Database settings](/dashboard/project/_/settings/database) inside the dashboard:
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ The schedule uses the standard cron syntax, in which \* means "run every time pe
|
||||
|
||||
You can use [crontab.guru](https://crontab.guru/) to help validate your cron schedules.
|
||||
|
||||
### Scheduling System Maintenance
|
||||
### Scheduling system maintenance
|
||||
|
||||
Be extremely careful when setting up pg_cron jobs for system maintenance tasks as they can have unintended consequences. For instance, scheduling a command to terminate idle connections with `pg_terminate_backend(pid)` can disrupt critical background processes like nightly backups. Often, there is an existing Postgres setting e.g. `idle_session_timeout` that can perform these common maintenance tasks without the risk.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const meta = {
|
||||
|
||||
[pg_hashids](https://github.com/iCyberon/pg_hashids) provides a secure way to generate short, unique, non-sequential ids from numbers. The hashes are intended to be small, easy-to-remember identifiers that can be used to obfuscate data (optionally) with a password, alphabet, and salt. For example, you may wish to hide data like user IDs, order numbers, or tracking codes in favor of `pg_hashid`'s unique identifers.
|
||||
|
||||
## Enable the Extension
|
||||
## Enable the extension
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
|
||||
@@ -102,7 +102,7 @@ The pgroonga index is used to retrieve the result set:
|
||||
| 2 | 'Groonga is a fast full text search engine that supports all languages.' |
|
||||
```
|
||||
|
||||
## Full Text Search
|
||||
## Full text search
|
||||
|
||||
The `&@~` operator performs full text search. It returns any matching results. Unlike `LIKE` operator, pgroonga can search any text that contains the keyword case insensitive.
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ In general, it is a bad idea to over-use column encryption for mundane data or d
|
||||
|
||||
Note that Supabase projects are already encrypted at rest by default.
|
||||
|
||||
## Get the Root Encryption Key for your Supabase Project
|
||||
## Get the root encryption key for your Supabase project
|
||||
|
||||
Encryption requires keys. Keeping the keys in the same database as the encrypted data would be unsafe. For more information about managing the pgsodium root encryption key on your Supabase project see **[encryption key location](#encryption-key-location)**. This key is required to decrypt values stored in [Supabase Vault](/docs/guides/database/vault) and data encrypted with Transparent Column Encryption.
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ API:
|
||||
- [`has_column()`](https://pgtap.org/documentation.html#has_column): Tests whether or not a column exists in a given table, view, materialized view or composite type.
|
||||
- [`col_is_pk()`](https://pgtap.org/documentation.html#col_is_pk): Tests whether the specified column or columns in a table is/are the primary key for that table.
|
||||
|
||||
## Testing RLS Policies
|
||||
## Testing RLS policies
|
||||
|
||||
```sql
|
||||
begin;
|
||||
@@ -132,7 +132,7 @@ API:
|
||||
- [`results_eq()`](https://pgtap.org/documentation.html#results_eq)
|
||||
- [`results_ne()`](https://pgtap.org/documentation.html#results_ne)
|
||||
|
||||
## Testing Functions
|
||||
## Testing functions
|
||||
|
||||
```sql
|
||||
prepare hello_expr as select 'hello'
|
||||
|
||||
@@ -79,7 +79,7 @@ Creates UUID values based solely on random numbers. You can also use Postgres's
|
||||
select uuid_generate_v4();
|
||||
```
|
||||
|
||||
### As a Primary Key
|
||||
### As a primary key
|
||||
|
||||
Automatically create a unique, random ID in a table:
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Wrappers introduce some new terminology and different workflows.
|
||||
|
||||

|
||||
|
||||
### Remote Servers
|
||||
### Remote servers
|
||||
|
||||
A Remote Server is an external database, API, or any system containing data that you want to query from your Postgres database. Examples include:
|
||||
|
||||
@@ -27,7 +27,7 @@ A Remote Server is an external database, API, or any system containing data that
|
||||
|
||||
It's possible to connect to multiple remote servers of the same type. For example, you can connect to two different Firebase projects within the same Supabase database.
|
||||
|
||||
### Foreign Tables
|
||||
### Foreign tables
|
||||
|
||||
A table in your database which maps to some data inside a Remote Server.
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ final result = await client
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Basic Full Text Queries
|
||||
## Basic full text queries
|
||||
|
||||
### Search a single column
|
||||
|
||||
@@ -407,7 +407,7 @@ final result = await client
|
||||
|
||||
Notice how searching for `big` includes results with the word `bigger` (or `biggest`, etc).
|
||||
|
||||
## Creating Indexes
|
||||
## Creating indexes
|
||||
|
||||
Now that we have Full Text Search working, let's create an `index`. This will allow Postgres to "build" the documents pre-emptively so that they
|
||||
don't need to be created at the time we execute the query. This will make our queries much faster.
|
||||
@@ -504,7 +504,7 @@ final result = await client
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Query Operators
|
||||
## Query operators
|
||||
|
||||
Visit [PostgreSQL: Text Search Functions and Operators](https://www.postgresql.org/docs/current/functions-textsearch.html)
|
||||
to learn about additional query operators you can use to do more advanced `full text queries`, such as:
|
||||
|
||||
@@ -32,7 +32,7 @@ and run the SQL queries yourself.
|
||||
3. Enter the SQL to create or replace your Database function.
|
||||
4. Click "Run" or cmd+enter (ctrl+enter).
|
||||
|
||||
## Simple Functions
|
||||
## Simple functions
|
||||
|
||||
Let's create a basic Database Function which returns a string "hello world".
|
||||
|
||||
@@ -313,7 +313,7 @@ GRANT EXECUTE ON FUNCTION hello_world TO service_role;
|
||||
- PostgreSQL Official Docs: [Chapter 9. Functions and Operators](https://www.postgresql.org/docs/current/functions.html)
|
||||
- PostgreSQL Reference: [CREATE FUNCTION](https://www.postgresql.org/docs/9.1/sql-createfunction.html)
|
||||
|
||||
## Deep Dive
|
||||
## Deep dive
|
||||
|
||||
### Create Database Functions
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ If you're importing a large dataset or importing data into production, plan ahea
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Option 1: CSV Import via Supabase Dashboard
|
||||
### Option 1: CSV import via Supabase dashboard
|
||||
|
||||
Supabase dashboard provides a user-friendly way to import data. However, for very large datasets, this method may not be the most efficient choice, given the size limit is 100MB. It's generally better suited for smaller datasets and quick data imports. Consider using alternative methods like pgloader for large-scale data imports.
|
||||
|
||||
1. Navigate to the relevant table in the [Table Editor.](/dashboard/project/_/editor)
|
||||
2. Click on “Insert” then choose "Import Data from CSV" and follow the on-screen instructions to upload your CSV file.
|
||||
|
||||
### Option 2: Bulk Import using pgloader
|
||||
### Option 2: Bulk import using pgloader
|
||||
|
||||
[pgloader](https://pgloader.io/) is a powerful tool for efficiently importing data into a PostgreSQL database that supports a wide range of source database engines, including MySQL and MS SQL.
|
||||
|
||||
@@ -68,7 +68,7 @@ You can use it in conjunction with Supabase by following these steps:
|
||||
|
||||
For databases using the Postgres engine, we recommend using the [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) and [psql](https://www.postgresql.org/docs/current/app-psql.html) command line tools.
|
||||
|
||||
### Option 3: Using Postgres Copy command
|
||||
### Option 3: Using Postgres copy command
|
||||
|
||||
Read more about [Bulk data loading.](/docs/guides/database/tables#bulk-data-loading)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ supabase link --project-ref <project-id>
|
||||
|
||||
Then the CLI will automatically connect to your Supabase project whenever you are in the project folder and you no longer need to provide `—db-url`.
|
||||
|
||||
## Inspection Commands
|
||||
## Inspection commands
|
||||
|
||||
Below are the db inspection commands provided, grouped by different use cases.
|
||||
|
||||
@@ -60,7 +60,7 @@ Some commands might require `pg_stat_statements` to be enabled or a specific Pos
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Disk Storage
|
||||
### Disk storage
|
||||
|
||||
These commands are handy if you are running low on disk storage:
|
||||
|
||||
@@ -71,7 +71,7 @@ These commands are handy if you are running low on disk storage:
|
||||
- [index-sizes](/docs/reference/cli/supabase-inspect-db-index-sizes) - shows the sizes of individual index
|
||||
- [table-index-sizes](/docs/reference/cli/supabase-inspect-db-table-index-sizes) - shows the sizes of indexes for each table
|
||||
|
||||
### Query Performance
|
||||
### Query performance
|
||||
|
||||
The commands below are useful if your Postgres database consumes a lot of resources like CPU, RAM or Disk IO. You can also use them to investigate slow queries.
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ const { data, error } = await supabase.from('countries').select(`
|
||||
`)
|
||||
```
|
||||
|
||||
### TypeScript Types for Joins
|
||||
### TypeScript types for joins
|
||||
|
||||
`supabase-js` always returns a `data` object (for success), and an `error` object (for unsuccessful requests).
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Every Supabase project comes with a full [Postgres](https://www.postgresql.org/)
|
||||
|
||||
## Features
|
||||
|
||||
### Table View
|
||||
### Table view
|
||||
|
||||
You don't have to be a database expert to start using Supabase. Our table view makes Postgres as easy to use as a spreadsheet.
|
||||
|
||||
@@ -39,7 +39,7 @@ You can duplicate your tables, just like you would inside a spreadsheet.
|
||||
/>
|
||||
</video>
|
||||
|
||||
### The SQL Editor
|
||||
### The SQL editor
|
||||
|
||||
Supabase comes with a SQL Editor. You can also save your favorite queries to run later!
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ Table partitioning is a technique that allows you to divide a large table into s
|
||||
|
||||
Each partition contains a subset of the data based on a specified criteria, such as a range of values or a specific condition. Partitioning can significantly improve query performance and simplify data management for large datasets.
|
||||
|
||||
## Benefits of Table Partitioning
|
||||
## Benefits of table partitioning
|
||||
|
||||
- **Improved query performance:** allows queries to target specific partitions, reducing the amount of data scanned and improving query execution time.
|
||||
- **Scalability:** With partitioning, you can add or remove partitions as your data grows or changes, enabling better scalability and flexibility.
|
||||
- **Efficient data management:** simplifies tasks such as data loading, archiving, and deletion by operating on smaller partitions instead of the entire table.
|
||||
- **Enhanced maintenance operations:** can optimize vacuuming and indexing, leading to faster maintenance tasks.
|
||||
|
||||
## Partitioning Methods
|
||||
## Partitioning methods
|
||||
|
||||
Postgres supports various partitioning methods based on how you want to partition your data. The commonly used methods are:
|
||||
|
||||
@@ -35,7 +35,7 @@ Postgres supports various partitioning methods based on how you want to partitio
|
||||
2. **List Partitioning**: Data is divided into partitions based on a specified list of values. For instance, you can partition a customer table by region, where each partition contains customers from a specific region (e.g., one partition for customers in the US, another for customers in Europe).
|
||||
3. **Hash Partitioning**: Data is distributed across partitions using a hash function. This method provides a way to evenly distribute data among partitions, which can be useful for load balancing. However, it doesn't allow direct querying based on specific values.
|
||||
|
||||
## Creating Partitioned Tables
|
||||
## Creating partitioned tables
|
||||
|
||||
Let's consider an example of range partitioning for a sales table based on the order date. We'll create monthly partitions to store data for each month:
|
||||
|
||||
@@ -64,7 +64,7 @@ create table sales_2000_02
|
||||
|
||||
To create a partitioned table you append `partition by range (<column_name>)` to the table creation statement. The column that you are partitioning with _must_ be included in any unique index, which is the reason why we specify a composite primary key here (`primary key (order_date, id)`).
|
||||
|
||||
## Querying Partitioned Tables
|
||||
## Querying partitioned tables
|
||||
|
||||
To query a partitioned table, you have two options:
|
||||
|
||||
@@ -108,7 +108,7 @@ There is no real threshold to determine when you should use partitions. Partitio
|
||||
|
||||
Here are simple examples for each of the partitioning types in Postgres.
|
||||
|
||||
### Range Partitioning
|
||||
### Range partitioning
|
||||
|
||||
Let's consider a range partitioning example for a table that stores sales data based on the order date. We'll create monthly partitions to store data for each month.
|
||||
|
||||
@@ -136,7 +136,7 @@ create table sales_2000_02
|
||||
for values from ('2000-02-01') to ('2000-03-01');
|
||||
```
|
||||
|
||||
### List Partitioning
|
||||
### List partitioning
|
||||
|
||||
Let's consider a list partitioning example for a table that stores customer data based on their region. We'll create partitions to store customers from different regions.
|
||||
|
||||
@@ -164,7 +164,7 @@ create table customers_asia
|
||||
for values in ('INDIA', 'CHINA', 'JAPAN');
|
||||
```
|
||||
|
||||
### Hash Partitioning
|
||||
### Hash partitioning
|
||||
|
||||
You can use hash partitioning to evenly distribute data.
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ You can also update the statement timeout for a session:
|
||||
set statement_timeout to 60000; -- 1 minute in milliseconds
|
||||
```
|
||||
|
||||
### Statement Optimization
|
||||
### Statement optimization
|
||||
|
||||
All Supabase projects come with the [`pg_stat_statements`](https://www.postgresql.org/docs/current/pgstatstatements.html) extension installed, which tracks planning and execution statistics for all statements executed against it. These statistics can be used in order to diagnose the performance of your project.
|
||||
|
||||
This data can further be used in conjunction with the [`explain`](https://www.postgresql.org/docs/current/using-explain.html) functionality of Postgres to optimize your usage.
|
||||
|
||||
## Managing Timezones
|
||||
## Managing timezones
|
||||
|
||||
Every Supabase database is set to UTC timezone by default. We strongly recommend keeping it this way, even if your users are in a different location.
|
||||
This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time".
|
||||
|
||||
@@ -8,7 +8,7 @@ export const meta = {
|
||||
|
||||
Enums in Postgres are a custom data type. They allow you to define a set of values (or labels) that a column can hold. They are useful when you have a fixed set of possible values for a column.
|
||||
|
||||
## Creating Enums
|
||||
## Creating enums
|
||||
|
||||
You can define a Postgres Enum using the `create type` statement. Here's an example:
|
||||
|
||||
@@ -24,7 +24,7 @@ create type mood as enum (
|
||||
|
||||
In this example, we've created an Enum called "mood" with four possible values.
|
||||
|
||||
## When to use Enums
|
||||
## When to use enums
|
||||
|
||||
There is a lot of overlap between Enums and foreign keys. Both can be used to define a set of values for a column. However, there are some advantages to using Enums:
|
||||
|
||||
@@ -38,7 +38,7 @@ There are also some disadvantages to using Enums:
|
||||
|
||||
In general you should only use Enums when the list of values is small, fixed, and unlikely to change often. Things like "a list of continents" or "a list of departments" are good candidates for Enums.
|
||||
|
||||
## Using Enums in tables
|
||||
## Using enums in tables
|
||||
|
||||
To use the Enum in a table, you can define a column with the Enum type. For example:
|
||||
|
||||
@@ -53,7 +53,7 @@ create table person (
|
||||
|
||||
Here, the `current_mood` column can only have values from the "mood" Enum.
|
||||
|
||||
### Inserting Data with Enums
|
||||
### Inserting data with enums
|
||||
|
||||
You can insert data into a table with Enum columns by specifying one of the Enum values:
|
||||
|
||||
@@ -65,7 +65,7 @@ values
|
||||
('Alice', 'happy');
|
||||
```
|
||||
|
||||
### Querying Data with Enums
|
||||
### Querying data with enums
|
||||
|
||||
When querying data, you can filter and compare Enum values as usual:
|
||||
|
||||
@@ -76,11 +76,11 @@ from person
|
||||
where current_mood = 'sad';
|
||||
```
|
||||
|
||||
## Managing Enums
|
||||
## Managing enums
|
||||
|
||||
You can manage your Enums using the `alter type` statement. Here are some examples:
|
||||
|
||||
### Updating Enum Values
|
||||
### Updating enum values
|
||||
|
||||
You can update the value of an Enum column:
|
||||
|
||||
@@ -91,7 +91,7 @@ set current_mood = 'excited'
|
||||
where name = 'Alice';
|
||||
```
|
||||
|
||||
### Adding Enum Values
|
||||
### Adding enum values
|
||||
|
||||
To add new values to an existing Postgres Enum, you can use the `ALTER TYPE` statement. Here's how you can do it:
|
||||
|
||||
@@ -102,7 +102,7 @@ Let's say you have an existing Enum called `mood`, and you want to add a new val
|
||||
alter type mood add value 'content';
|
||||
```
|
||||
|
||||
### Removing Enum Values
|
||||
### Removing enum values
|
||||
|
||||
Even though it is possible, it is unsafe to remove enum values once they have been created. It's better to leave the enum value in place.
|
||||
|
||||
@@ -114,7 +114,7 @@ There is no `ALTER TYPE DELETE VALUE` in Postgres. Even if you delete every occu
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Getting a list of Enum Values
|
||||
### Getting a list of enum values
|
||||
|
||||
Check your existing Enum values by querying the enum_range function:
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
Postgres manages database access permissions using the concept of roles. Generally you wouldn't use these roles for your own application - they are mostly for configuring _system access_ to your database. If you want to configure _application access_, then you should use [Row Level Security](/docs/guides/database/postgres/row-level-security).
|
||||
|
||||
## Users vs Roles
|
||||
## Users vs roles
|
||||
|
||||
In PostgreSQL, roles can function as users or groups of users. Users are roles with login privileges, while groups (also known as role groups) are roles that don't have login privileges but can be used to manage permissions for multiple users.
|
||||
|
||||
@@ -46,11 +46,11 @@ If you use special symbols in your Postgres password, you must remember to [perc
|
||||
|
||||
When you created your project you were also asked to enter a password. This is actually the password for the `postgres` role in your database. You can update this from the Dashboard under the [database settings](https://supabase.com/dashboard/project/_/settings/database) page. You should _never_ give this to 3rd-party service unless you absolutely trust them. Instead, we recommend that you create a new user for every service that you want to give access too. This will also help you with debugging - you can see every query that each role is executing in your database within `pg_stat_statements`.
|
||||
|
||||
## Granting Permissions
|
||||
## Granting permissions
|
||||
|
||||
Roles can be granted various permissions on database objects using the `GRANT` command. Permissions include `SELECT`, `INSERT`, `UPDATE`, and `DELETE`. You can configure access to almost any object inside your database - including tables, views, functions, and triggers.
|
||||
|
||||
## Revoking Permissions
|
||||
## Revoking permissions
|
||||
|
||||
Permissions can be revoked using the `REVOKE` command:
|
||||
|
||||
@@ -58,7 +58,7 @@ Permissions can be revoked using the `REVOKE` command:
|
||||
REVOKE permission_type ON object_name FROM role_name;
|
||||
```
|
||||
|
||||
## Role Hierarchy
|
||||
## Role hierarchy
|
||||
|
||||
Roles can be organized in a hierarchy, where one role can inherit permissions from another. This simplifies permission management, as you can define permissions at a higher level and have them automatically apply to all child roles.
|
||||
|
||||
@@ -78,7 +78,7 @@ In some cases, you might want to prevent a role from having a child relationship
|
||||
alter role "child_role_name" noinherit;
|
||||
```
|
||||
|
||||
## Supabase Roles
|
||||
## Supabase roles
|
||||
|
||||
Postgres comes with a set of [predefined roles](https://www.postgresql.org/docs/current/predefined-roles.html). Supabase extends this with a default set of roles which are configured on your database when you start a new project:
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ alter table "table_name" enable row level security;
|
||||
|
||||
Once you have enabled RLS, no data will be accessible via the [API](/docs/guides/api) when using the public `anon` key, until you create policies.
|
||||
|
||||
## Creating Policies
|
||||
## Creating policies
|
||||
|
||||
Policies are simply SQL logic that you attach to a Postgres table. You can attach as many policies as you want to each table.
|
||||
|
||||
Supabase provides some [helpers](/docs/guides/auth/row-level-security#helper-functions) that simplify RLS if you're using Supabase Auth. We'll use these helpers to illustrate some basic policies:
|
||||
|
||||
### SELECT Policies
|
||||
### SELECT policies
|
||||
|
||||
You can specify select policies with the `using` clause.
|
||||
|
||||
@@ -84,7 +84,7 @@ on profiles
|
||||
for select using ( auth.uid() = user_id );
|
||||
```
|
||||
|
||||
### INSERT Policies
|
||||
### INSERT policies
|
||||
|
||||
You can specify insert policies with the `with check` clause.
|
||||
|
||||
@@ -108,7 +108,7 @@ to authenticated -- the Postgres Role (recommended)
|
||||
with check ( auth.uid() = user_id ); -- the actual Policy
|
||||
```
|
||||
|
||||
### UPDATE Policies
|
||||
### UPDATE policies
|
||||
|
||||
You can specify update policies with the `using` clause.
|
||||
|
||||
@@ -132,7 +132,7 @@ to authenticated -- the Postgres Role (recommended)
|
||||
using ( auth.uid() = user_id ); -- the actual Policy
|
||||
```
|
||||
|
||||
### DELETE Policies
|
||||
### DELETE policies
|
||||
|
||||
You can specify delete policies with the `using` clause.
|
||||
|
||||
@@ -166,7 +166,7 @@ grant bypassrls on "table_name" to "role_name";
|
||||
|
||||
This can be useful for system-level access. You should _never_ share login credentials for any Postgres Role with this privilege.
|
||||
|
||||
## RLS Performance Recommendations
|
||||
## RLS performance recommendations
|
||||
|
||||
Every authorization system has an impact on performance. While row level security is powerful, the performance impact is important to keep in mind. This is especially true for queries that scan every row in a table - like many `select` operations, including those using limit, offset, and ordering.
|
||||
|
||||
@@ -351,7 +351,7 @@ If the list exceeds 1000 items, a different approach may be needed or you may ne
|
||||
| --------------------------------------------------------------------------------------------------- | ----------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [test5-fixed-join](https://github.com/GaryAustin1/RLS-Performance/tree/main/tests/test5-fixed-join) | 9,000 | 20 | 99.78% | <details className="cursor-pointer">Before:<br/>`auth.uid()` in table join on col<br/><br/>After:<br/>col in table join on `auth.uid()`</details> |
|
||||
|
||||
### Specify Roles in your Policies
|
||||
### Specify roles in your policies
|
||||
|
||||
Always use the Role of inside your policies, specified by the `TO` operator. For example, instead of this query:
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
In Postgres, a trigger executes a set of actions automatically on table events such as INSERTs, UPDATEs, DELETEs, or TRUNCATE operations.
|
||||
|
||||
## Creating a Trigger
|
||||
## Creating a trigger
|
||||
|
||||
Creating triggers involve 2 parts:
|
||||
|
||||
@@ -25,7 +25,7 @@ for each row
|
||||
execute function trigger_function();
|
||||
```
|
||||
|
||||
## Trigger Functions
|
||||
## Trigger functions
|
||||
|
||||
A trigger function is a user-defined [Function](docs/guides/database/functions) that Postgres executes when the trigger is fired.
|
||||
|
||||
@@ -70,7 +70,7 @@ Here are some of the key variables and options available within trigger function
|
||||
- `TG_ARGV`: An array of string arguments provided when creating the trigger.
|
||||
- `TG_NARGS`: The number of arguments in the `TG_ARGV` array.
|
||||
|
||||
## Types of Triggers
|
||||
## Types of triggers
|
||||
|
||||
There are two types of trigger, `BEFORE` and `AFTER`:
|
||||
|
||||
@@ -103,7 +103,7 @@ There are two options available for executing triggers:
|
||||
- `for each row`: specifies that the trigger function should be executed once for each affected row.
|
||||
- `for each statement`: the trigger is executed once for the entire operation (eg, once on insert). This can be more efficient than `for each row` when dealing with multiple rows affected by a single SQL statement, as they allow you to perform calculations or updates on groups of rows at once.
|
||||
|
||||
## Dropping a Trigger
|
||||
## Dropping a trigger
|
||||
|
||||
You can delete a trigger using the `drop trigger` command:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ This is not a comprehensive resource, but rather a helpful starting point for yo
|
||||
|
||||
If you're new to query optimization, you may be interested in [index_advisor](/docs/guides/database/extensions/index_advisor), our tool for automatically detecting indexes that improve performance on a given query.
|
||||
|
||||
## Example Query
|
||||
## Example query
|
||||
|
||||
Consider the following example query that retrieves customer names and purchase dates from two tables:
|
||||
|
||||
@@ -74,11 +74,11 @@ Sorting can also be optimized by indexing:
|
||||
create index idx_orders_date_of_purchase on orders (date_of_purchase);
|
||||
```
|
||||
|
||||
## Key Concepts
|
||||
## Key concepts
|
||||
|
||||
Here are some concepts and tools to keep in mind to help you identify the best index for the job, and measure the impact that your index had:
|
||||
|
||||
### Analyze the Query Plan
|
||||
### Analyze the query plan
|
||||
|
||||
Use the `explain` command to understand the query's execution. Look for slow parts, such as Sequential Scans or high cost numbers. If creating an index does not reduce the cost of the query plan, remove it.
|
||||
|
||||
@@ -88,7 +88,7 @@ For example:
|
||||
explain select * from customers where sign_up_date > 25;
|
||||
```
|
||||
|
||||
### Use Appropriate Index Types
|
||||
### Use appropriate index types
|
||||
|
||||
Postgres offers various index types like [B-tree, Hash, GIN, etc](https://www.postgresql.org/docs/current/indexes-types.html). Select the type that best suits your data and query pattern. Using the right index type can make a significant difference. For example, using a BRIN index on a field that always increases and lives within a table that updates infrequently - like `created_at` on an `orders` table - routinely results in indexes that are +10x smaller than the equivalent default B-tree index. That translates into better scalability.
|
||||
|
||||
@@ -96,7 +96,7 @@ Postgres offers various index types like [B-tree, Hash, GIN, etc](https://www.po
|
||||
create index idx_orders_created_at ON customers using brin(created_at);
|
||||
```
|
||||
|
||||
### Partial Indexes
|
||||
### Partial indexes
|
||||
|
||||
For queries that frequently target a subset of data, a partial index could be faster and smaller than indexing the entire column. A partial index contains a `where` clause to filter the values included in the index. Note that a query's `where` clause must match the index for it to be used.
|
||||
|
||||
@@ -105,7 +105,7 @@ create index idx_orders_status on orders (status)
|
||||
where status = 'shipped';
|
||||
```
|
||||
|
||||
### Composite Indexes
|
||||
### Composite indexes
|
||||
|
||||
If filtering or joining on multiple columns, a composite index prevents Postgres from referring to multiple indexes when identifying the relevant rows.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Replication is a technique for copying the data from one database to another. Su
|
||||
|
||||
Replication is done through _publications_, a method of choosing which changes to send to other systems (usually another Postgres database). Publications can be managed in the [Dashboard](https://supabase.com/dashboard) or with SQL.
|
||||
|
||||
## Manage publications in the Dashboard
|
||||
## Manage publications in the dashboard
|
||||
|
||||
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
|
||||
2. Click on **Replication** in the sidebar.
|
||||
|
||||
@@ -21,7 +21,7 @@ For example, this table has 3 "columns" (`id`, `name`, `description`) and 4 "row
|
||||
|
||||
There are a few important differences from a spreadsheet, but it's a good starting point if you're new to Relational databases.
|
||||
|
||||
## Creating Tables
|
||||
## Creating tables
|
||||
|
||||
When creating a table, it's best practice to add columns at the same time.
|
||||
|
||||
@@ -140,7 +140,7 @@ if the default types don't fit your needs. You can use any data type that Postgr
|
||||
You can "cast" columns from one type to another, however there can be some incompatibilities between types.
|
||||
For example, if you cast a `timestamp` to a `date`, you will lose all the time information that was previously saved.
|
||||
|
||||
### Primary Keys
|
||||
### Primary keys
|
||||
|
||||
A table can have a "primary key" - a unique identifier for every row of data. A few tips for Primary Keys:
|
||||
|
||||
@@ -260,7 +260,7 @@ psql -h DATABASE_URL -p 5432 -d postgres -U postgres \
|
||||
|
||||
If you receive an error `FATAL: password authentication failed for user "postgres"`, reset your database password in the Database Settings and try again.
|
||||
|
||||
## Joining tables with Foreign Keys
|
||||
## Joining tables with foreign keys
|
||||
|
||||
Tables can be "joined" together using Foreign Keys.
|
||||
|
||||
@@ -471,7 +471,7 @@ where courses.code != 'PG101';
|
||||
|
||||
Without a view, we would need to go into every dependent query to add the new rule. This would increase in the likelihood of errors and inconsistencies, as well as introducing a lot of effort for a developer. With views, we can alter just the underlying query in the view **transcripts**. The change will be applied to all applications using this view.
|
||||
|
||||
#### Logical Organization
|
||||
#### Logical organization
|
||||
|
||||
With views, we can give our query a name. This is extremely useful for teams working with the same database. Instead of guessing what a query is supposed to do, a well-named view can easily explain it. For example, by looking at the name of the view **transcripts**, we can infer that the underlying query might involve the **students**, **courses**, and **grades** tables.
|
||||
|
||||
@@ -479,7 +479,7 @@ With views, we can give our query a name. This is extremely useful for teams wor
|
||||
|
||||
Views can restrict the amount and type of data presented to a user. Instead of allowing a user direct access to a set of tables, we provide them a view instead. We can prevent them from reading sensitive columns by excluding them from the underlying query.
|
||||
|
||||
### Materialized Views
|
||||
### Materialized views
|
||||
|
||||
A [materialized view](https://www.postgresql.org/docs/12/rules-materializedviews.html) is a form of view but it also stores the results to disk. In subsequent reads of a materialized view, the time taken to return its results would be much faster than a conventional view. This is because the data is readily available for a materialized view while the conventional view executes the underlying query each time it is called.
|
||||
|
||||
@@ -515,7 +515,7 @@ refresh materialized view transcripts;
|
||||
|
||||
It's up to you how regularly refresh your materialized views, and it's probably different for each view depending on its use-case.
|
||||
|
||||
### Materialized views vs Conventional views
|
||||
### Materialized views vs conventional views
|
||||
|
||||
Materialized views are useful when execution times for queries or views are too slow. These could likely occur in views or queries involving multiple tables and billions of rows. When using such a view, however, there should be tolerance towards data being outdated. Some use-cases for materialized views are internal dashboards and analytics.
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ There are two main parts to the Vault UI, Secrets and Encryption Keys:
|
||||
|
||||
You can use the Vault to store secrets - everything from Environment Variables to API Keys. You can then use these secrets anywhere in your database: Postgres [Functions](/docs/guides/database/functions), Triggers, and [Webhooks](/docs/guides/database/webhooks). From a SQL perspective, accessing secrets is as easy as querying a table (or in this case, a view). The underlying secrets tables will be stored in encrypted form.
|
||||
|
||||
## Encryption Keys
|
||||
## Encryption keys
|
||||
|
||||
These are keys used to encrypt data inside your database. You can create different Encryption Keys for different purposes, for example: one for encrypting user-data, and another for application-data. Each key is encrypted itself using a root encryption key that lives outside of the database. See **[Encryption key location](#encryption-key-location)** for more details.
|
||||
|
||||
@@ -161,7 +161,7 @@ Notice how this view has a `decrypted_secret` column that contains the decrypted
|
||||
|
||||
You should ensure that you protect access to this view with the appropriate SQL privilege settings at all times, as anyone that has access to the view has access to decrypted secrets.
|
||||
|
||||
### Updating Secrets
|
||||
### Updating secrets
|
||||
|
||||
A secret can be updated with the `vault.update_secret()` function, this function makes updating secrets easy, just provide the secret UUID as the first argument, and then an updated secret, updated optional unique name, or updated description:
|
||||
|
||||
@@ -197,7 +197,7 @@ updated_at | 2022-12-14 02:51:13.938396+00
|
||||
|
||||
</details>
|
||||
|
||||
## Deep Dive
|
||||
## Deep dive
|
||||
|
||||
<div className="video-container">
|
||||
<iframe
|
||||
@@ -211,7 +211,7 @@ updated_at | 2022-12-14 02:51:13.938396+00
|
||||
|
||||
As we mentioned, the Vault uses pgsodium's Transparent Column Encryption (TCE) to store secrets in an authenticated encrypted form. There are some details around that you may be curious about, what does authenticated mean, and where are encryption keys store? This section explains those details.
|
||||
|
||||
### Authenticated Encryption with Associated Data
|
||||
### Authenticated encryption with associated data
|
||||
|
||||
The first important feature of TCE is that it uses an [Authenticated Encryption with Associated Data](<https://en.wikipedia.org/wiki/Authenticated_encryption#Authenticated_encryption_with_associated_data_(AEAD)>) encryption algorithm (based on libsodium).
|
||||
|
||||
@@ -227,7 +227,7 @@ This is an important safety precaution - there is little value in storing the en
|
||||
|
||||
Where are the keys stored? Supabase creates and manages the root keys (from which all key IDs are derived) in our secured backend systems. We keep this root key safe and separate from your data. You remain in control of your keys - a separate API endpoint is available that you can use to access the key if you want to decrypt your data outside of Supabase.
|
||||
|
||||
### Internal Details
|
||||
### Internal details
|
||||
|
||||
To encrypt data, you need a _key id_. You can use the default key id created automatically for every project, or create your own key ids Using the `pgsodium.create_key()` function. Key ids are used to internally derive the encryption key used to encrypt secrets in the vault. Vault users typically do not have access to the key itself, only the key id.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Database Webhooks allow you to send real-time data from your database to another
|
||||
|
||||
You can hook into three table events: `INSERT`, `UPDATE`, and `DELETE`. All events are fired _after_ a database row is changed.
|
||||
|
||||
## Webhooks vs Triggers
|
||||
## Webhooks vs triggers
|
||||
|
||||
Database Webhooks are very similar to triggers, and that's because Database Webhooks are just a convenience wrapper around triggers using the [pg_net](/docs/guides/database/extensions/pgnet) extension. This extension is asynchronous, and therefore will not block your database changes for long-running network requests.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
Edge Functions work seamlessly with [Supabase Auth](/docs/guides/auth).
|
||||
|
||||
## Auth Context
|
||||
## Auth context
|
||||
|
||||
When a user makes a request to an Edge Function, you can use the Authorization header to set the Auth context in the Supabase client:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export const meta = {
|
||||
|
||||
You can use the official [`setup-cli` GitHub Action](https://github.com/marketplace/actions/supabase-cli-action) to run Supabase CLI commands in your GitHub Actions.
|
||||
|
||||
## Sample Workflow
|
||||
## Sample workflow
|
||||
|
||||
The following GitHub Action deploys all Edge Functions any time code is merged into the `main` branch:
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- run: supabase functions deploy --project-ref $PROJECT_ID
|
||||
```
|
||||
|
||||
## Declarative Configuration
|
||||
## Declarative configuration
|
||||
|
||||
Individual function configuration like [JWT verification](/docs/guides/cli/config#functions.function_name.verify_jwt) and [import map location](/docs/guides/cli/config#functions.function_name.import_map) can be set via the `config.toml` file.
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ Deno.serve(async (_req) => {
|
||||
})
|
||||
```
|
||||
|
||||
## SSL Connections
|
||||
## SSL connections
|
||||
|
||||
Deployed edge functions are pre-configured to use SSL for connections to the Supabase database. You don't need to add any extra configurations.
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ supabase:
|
||||
webhook_handler: 'lib/webhooks.dart'
|
||||
```
|
||||
|
||||
## Using Supabase Client
|
||||
## Using Supabase client
|
||||
|
||||
Now let’s try to interact with our Supabase database. We will start by installing the dependencies.
|
||||
|
||||
@@ -92,7 +92,7 @@ We also need to use a special HTTP client to HTTP requests in the edge environme
|
||||
dart pub add edge_http_client
|
||||
```
|
||||
|
||||
### Initialize SupabaseClient
|
||||
### Initialize `SupabaseClient`
|
||||
|
||||
At this point, you can initialize a `SupabaseClient` by passing the [EdgeHttpClient](https://pub.dev/packages/edge_http_client). We can access the Supabase credentials through the [environment variables](https://supabase.com/docs/guides/functions/secrets) using `Deno.env.get()` method. Note that [Supabase credentials are available by default](https://supabase.com/docs/guides/functions/secrets), so no configurations are necessary.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export const meta = {
|
||||
subtitle: 'Debugging tips and Edge Function limitations.',
|
||||
}
|
||||
|
||||
## Logs & Debugging
|
||||
## Logs & debugging
|
||||
|
||||
Logs are provided for each function invocation, locally and in production.
|
||||
|
||||
@@ -70,13 +70,13 @@ There are two debugging tools available: Invocations and Logs. Invocations shows
|
||||
- Search the [Edge Runtime](https://github.com/supabase/edge-runtime) and [CLI](https://github.com/supabase/cli) repos for the error message, to see if it has been reported before.
|
||||
- If the output from the commands above does not help you to resolve the issue, please open a support ticket via the Supabase Dashboard (by clicking the "Help" button at the top right) and include all output and details about your commands.
|
||||
|
||||
## Advanced Techniques
|
||||
## Advanced techniques
|
||||
|
||||
### Checking Function Boot Time
|
||||
### Checking function boot time
|
||||
|
||||
Check the logs for the function. In the logs, look for a "Booted" event and note the reported boot time. If available, click on the event to access more details, including the regions from where the function was served. Investigate if the boot time is excessively high (longer than 1 second) and note any patterns or regions where it occurs.
|
||||
|
||||
### Finding Bundle Size
|
||||
### Finding bundle size
|
||||
|
||||
To find the bundle size of a function, run the following command locally:
|
||||
|
||||
@@ -86,7 +86,7 @@ deno info /path/to/function/index.ts
|
||||
|
||||
Look for the "size" field in the output which represents the approximate bundle size of the function.You can find the accurate bundle size when you deploy your function via Supabase CLI. If the function is part of a larger application, consider examining the bundle size of the specific function independently.
|
||||
|
||||
### Analyze Dependencies
|
||||
### Analyze dependencies
|
||||
|
||||
Run `deno info`, providing the path to your input map if you use one.
|
||||
Review the dependencies listed in the output. Pay attention to any significantly large dependencies, as they can contribute to increased bundle size and potential boot time issues.
|
||||
|
||||
@@ -24,7 +24,7 @@ See the [CLI Docs](/docs/guides/cli) to learn how to install the Supabase CLI on
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Get your Project ID
|
||||
## Get your project ID
|
||||
|
||||
Get the project ID associated with your function by running:
|
||||
|
||||
@@ -74,7 +74,7 @@ supabase functions deploy hello-world --no-verify-jwt
|
||||
|
||||
Be careful when using this flag, as it will allow anyone to invoke your Edge Function without a valid JWT. The Supabase client libraries automatically handle authorization.
|
||||
|
||||
## Invoking remote Functions
|
||||
## Invoking remote functions
|
||||
|
||||
You can now invoke your Edge Function using the project's `ANON_KEY`, which can be found in the [API settings](https://supabase.com/dashboard/project/_/settings/api) of the Supabase Dashboard.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export const meta = {
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
## Create an application on Discord Developer Portal
|
||||
## Create an application on Discord Developer portal
|
||||
|
||||
1. Go to [https://discord.com/developers/applications](https://discord.com/developers/applications) (login using your discord account if required).
|
||||
2. Click on **New Application** button available at left side of your profile picture.
|
||||
@@ -140,7 +140,7 @@ function hexToUint8Array(hex: string) {
|
||||
}
|
||||
```
|
||||
|
||||
## Deploy the Slash Command Handler
|
||||
## Deploy the Slash Command handler
|
||||
|
||||
```bash
|
||||
supabase functions deploy discord-bot --no-verify-jwt
|
||||
|
||||
@@ -10,14 +10,14 @@ export const meta = {
|
||||
|
||||
Find the example code on [GitHub](https://github.com/supabase/supabase/blob/master/examples/user-management/expo-push-notifications/).
|
||||
|
||||
## Supabase Setup
|
||||
## Supabase setup
|
||||
|
||||
- [Create a new Supabase project](https://database.new).
|
||||
- Link your project: `supabase link --project-ref your-supabase-project-ref`
|
||||
- Start supabase locally: `supabase start`
|
||||
- Push up the schema: `supabase db push` (schema is defined in [supabase/migrations](https://github.com/supabase/supabase/blob/master/examples/user-management/expo-push-notifications/supabase/migrations/))
|
||||
|
||||
## Expo Setup
|
||||
## Expo setup
|
||||
|
||||
To utilize Expo's push notification service, you must configure your app by installing a set of libraries, implementing functions to handle notifications, and setting up credentials for Android and iOS. Follow the official [Expo Push Notifications Setup Guide](https://docs.expo.dev/push-notifications/push-notifications-setup/) to get the credentials for Android and iOS. This project uses [Expo's EAS build](https://docs.expo.dev/build/introduction/) service to simplify this part.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const meta = {
|
||||
|
||||
The Slack Bot Mention Edge Function allows you to process mentions in Slack and respond accordingly.
|
||||
|
||||
## Configuring Slack Apps
|
||||
## Configuring Slack apps
|
||||
|
||||
For your bot to seamlessly interact with Slack, you'll need to configure Slack Apps:
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import process from 'node:process'
|
||||
|
||||
You can learn more about `npm:` specifiers and Node built-in APIs, in [Deno's documentation](https://docs.deno.com/runtime/manual/node/npm_specifiers).
|
||||
|
||||
## Importing Types
|
||||
## Importing types
|
||||
|
||||
If your [environment is set up properly](/docs/guides/functions/local-development) and the module you're importing is exporting types, the import will have types and autocompletion support.
|
||||
|
||||
@@ -50,7 +50,7 @@ To include types for built-in Node APIs, add the following line to the top of yo
|
||||
/// <reference types="npm:@types/node" />
|
||||
```
|
||||
|
||||
## Using Import Maps
|
||||
## Using import maps
|
||||
|
||||
An [Import Map](https://github.com/WICG/import-maps#the-import-map) is similar to a `package.json` file. They are a way to manage your dependencies. Consider this code:
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const meta = {
|
||||
|
||||
We recommend installing the Deno CLI and related tools for local development.
|
||||
|
||||
## Deno Support
|
||||
## Deno support
|
||||
|
||||
You can follow the [Deno guide](https://deno.com/manual@v1.32.5/getting_started/setup_your_environment) for setting up your development environment with your favorite editor/IDE.
|
||||
|
||||
@@ -39,7 +39,7 @@ To enable the Deno language server only for the `supabase/functions` folder, add
|
||||
}
|
||||
```
|
||||
|
||||
## Multi-root workspaces in VS Code
|
||||
## Multi-root workspaces in VSCode
|
||||
|
||||
When developing with VS Code inside of an existing application, you can utilize [multi-root workspaces](https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces).
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ Read on for some common development tips.
|
||||
|
||||
Here are a few recommendations when developing Edge Functions.
|
||||
|
||||
### Skipping Authorization checks
|
||||
### Skipping authorization checks
|
||||
|
||||
By default, Edge Functions require a valid JWT in the authorization header. If you want to use Edge Functions without Authorization checks (commonly used for Stripe webhooks), you can pass the `--no-verify-jwt` flag when serving your Edge Functions locally.
|
||||
|
||||
@@ -128,7 +128,7 @@ supabase functions serve hello-world --no-verify-jwt
|
||||
|
||||
Be careful when using this flag, as it will allow anyone to invoke your Edge Function without a valid JWT. The Supabase client libraries automatically handle authorization.
|
||||
|
||||
### Using HTTP Methods
|
||||
### Using HTTP methods
|
||||
|
||||
Edge Functions support `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, and `OPTIONS`. A Function can be designed to perform different actions based on a request's HTTP method. See the [example on building a RESTful service](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/restful-tasks) to learn how to handle different HTTP methods in your Function.
|
||||
|
||||
@@ -176,7 +176,7 @@ verify_jwt = false
|
||||
import_map = './import_map.json'
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
### Error handling
|
||||
|
||||
The `supabase-js` library provides several error types that you can use to handle errors that might occur when invoking Edge Functions:
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ Please make sure to replace the placeholders (`supabaseUrl`, `supabaseKey`, `my_
|
||||
|
||||
</Admonition>
|
||||
|
||||
## Running Edge Functions Locally
|
||||
## Running Edge Functions locally
|
||||
|
||||
To locally test and debug Edge Functions, you can utilize the Supabase CLI. Let's explore how to run Edge Functions locally using the Supabase CLI:
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export const meta = {
|
||||
|
||||
</div>
|
||||
|
||||
### Use Cases
|
||||
### Use cases
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{useCases.map((item) => {
|
||||
@@ -55,7 +55,7 @@ export const meta = {
|
||||
})}
|
||||
</div>
|
||||
|
||||
### Framework Quickstarts
|
||||
### Framework quickstarts
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{quickstarts.map((item) => {
|
||||
@@ -75,7 +75,7 @@ export const meta = {
|
||||
})}
|
||||
</div>
|
||||
|
||||
### Web App Tutorials
|
||||
### Web app tutorials
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{webapps.map((item) => {
|
||||
@@ -97,7 +97,7 @@ export const meta = {
|
||||
|
||||
</div>
|
||||
|
||||
### Mobile Tutorials
|
||||
### Mobile tutorials
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-6 not-prose">
|
||||
{mobile.map((item) => {
|
||||
|
||||
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user