All Products
Search
Document Center

AnalyticDB:Implement third-party sign-in with Supabase

Last Updated:Mar 28, 2026

AnalyticDB for PostgreSQL hosts a Supabase authentication service that supports third-party identity providers (IdPs), including Alipay, WeChat, and Google. This guide walks you through configuring Google as an OAuth 2.0 provider end to end — from obtaining credentials in Google Cloud to calling the sign-in API from your application.

Prerequisites

Before you begin, ensure that you have:

  • A Supabase project created after the following dates (earlier projects do not support this feature): For setup instructions, see Create a Supabase project.

    • China regions: September 4, 2025

    • Singapore: August 29, 2025

    To check whether your project's region is supported, sign in to the Supabase Dashboard and confirm that Authentication > Sign In/Providers appears in the left navigation pane.

  • Public network access enabled for your Supabase project.

How it works

The configuration involves three parties: your application, Supabase (hosted on AnalyticDB for PostgreSQL), and Google.

  1. Your application redirects the user to Supabase's authorization endpoint.

  2. Supabase redirects the user to Google's consent screen using the OAuth 2.0 client credentials you configured.

  3. After the user consents, Google sends an authorization code to Supabase's callback URL.

  4. Supabase exchanges the code for tokens and redirects the user to your application's site URL.

Configure Google sign-in

To make setup efficient, open two browser tabs: one for the Google Identity Platform console and one for the Supabase Dashboard. You will copy values back and forth between them.

Step 1: Get your OAuth 2.0 credentials from Google

  1. Sign in to Google Cloud Platform and open or register a project.

  2. Go to the Google Identity Platform console and configure your application.

    image.png

  3. In the left navigation pane, click Clients and create an OAuth 2.0 client ID.

    image

  4. Under OAuth 2.0 Client IDs, click the client you just created. Copy and save the client ID and client secret — you will need both in the next step.

    image.png

Step 2: Enable Google in the Supabase Dashboard

  1. In the Supabase Dashboard, go to Authentication > Sign In/Providers.

    image.png

  2. Enable Google, paste in the client ID and client secret from Step 1, then copy the callback URL shown on this page. Click Save. The callback URL follows this format:

    http://<SUPABASE_PUBLIC_URL>/auth/v1/callback

    Keep this URL — you will register it with Google in the next step.

    image

Step 3: Register the callback URL in Google

  1. Return to the Google Identity Platform console.

  2. Open the OAuth 2.0 client you created in Step 1 and add the callback URL from Step 2 to the Authorized redirect URIs list.

    image.png

Step 4: Set the site URL

  1. In the Supabase Dashboard, go to Authentication > URL Configuration.

  2. Set Site URL to your application's homepage. After a successful sign-in, users are redirected here.

    image

Trigger sign-in from your application

Once configured, use either of the following methods to start a Google sign-in flow.

Option 1: Direct URL redirect

Get your SUPABASE_PUBLIC_URL from the Supabase Dashboard: click Connect in the upper-left corner, then click App Frameworks.

http://<SUPABASE_PUBLIC_URL>/auth/v1/authorize?provider=google

Option 2: supabase-js

For installation and the full API reference, see the supabase-js documentation.

const { data, error } = await supabase.auth.signInWithOAuth({
  provider: 'google'
})

What's next

To configure other identity providers such as Alipay or WeChat, see the Supabase authentication documentation.