Files
2025-05-28 09:55:51 +08:00
..
2025-05-28 09:55:51 +08:00
2025-05-28 09:55:51 +08:00

Build a Supabase Marketplace Integration

Supabase offers an OAuth2 connection flow and a Management API allowing you to build Supabase Marketplace Integrations that connect to our users' hosted Supabase projects, making it more convenient than ever to create scalabale backends programmatically and tap into the extensive pool of Supabase users.

Setup

  1. Follow the steps in the docs to create an OAuth App.
  2. Set SUPA_CONNECT_CLIENT_ID and SUPA_CONNECT_CLIENT_SECRET in your .env.local file as shown in the .env.local.example file.

Connect to Supabase using OAuth2

This example showcases and end-to-end OAuth2 connection flow with PKCE, with the following steps:

  1. Create authorization URL with PKCE codeVerifier.
  2. Redirect user to Supabase to authorize your application to connect to their Supabase account.
  3. User gets redirected to the callback route, where we exchange the code in the URL for access_token and refresh_token.
  4. We use the access_token to retrieve a list of the user's projects using the supabase-management-js library.

Run locally

supabase functions serve connect-supabase --no-verify-jwt --env-file ./supabase/.env.local

Navigate to http://localhost:54321/functions/v1/connect-supabase

Deploy to Supabase Edge Functions

supabase functions deploy connect-supabase --no-verify-jwt
supabase secrets set --env-file ./supabase/.env.local