# Social login (/build/connectors/supabase/social-auth)

<LlmsDirective />

<Info>
  Enable social sign-in providers in Supabase and connect them to your Rocket app. This guide uses Google as an example. The process is similar for other providers.
</Info>

<Warning>
  Social sign-in only works on your app's live preview or custom domain. It will not work inside Rocket's preview.
</Warning>

## Set up a social provider in Supabase [#set-up-a-social-provider-in-supabase]

The steps below use Google as an example.
The process is similar for other providers. For provider-specific instructions, refer to their documentation.

<Steps>

  <Step title="Open the provider settings in Supabase">
    1. In your Supabase project, go to **Authentication** from the left menu.
    2. Click **Sign In / Providers**.
    3. Select your provider. In this case, choose **Google**.

    <Frame caption="Open provider settings in Supabase">
      <img src="/images/build/connectors/supabase/social-auth/supabase-auth-providers-list-light.webp" alt="List of authentication providers inside Supabase settings." className="theme-image light-image" />
      <img src="/images/build/connectors/supabase/social-auth/supabase-auth-providers-list-dark.webp" alt="List of authentication providers inside Supabase settings." className="theme-image dark-image" />
    </Frame>

    The provider settings panel opens, showing fields for credentials and a callback URL.
  </Step>

  <Step title="Create credentials in the provider console">
    In your provider's developer console (e.g., Google Cloud Console):

    - Create a new OAuth 2.0 Client ID and Secret.
    - Under **Authorized JavaScript origins**, enter your Rocket app's live preview URL or custom domain. Do not use localhost.
    - Under **Authorized redirect URIs**, paste the **Callback URL** from Supabase.

    For Google, refer to the [Google OAuth setup guide](https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred).

    You now have a Client ID and Client Secret from your provider.
  </Step>

  <Step title="Enter credentials into Supabase">
    Back in Supabase, on the selected provider's settings page:

    1. Paste the **Client ID** into the first field.
    2. Paste the **Client Secret** into the second field.
    3. Copy the **Redirect URL** shown in the third field.
    Make sure this exact URL is also set in your provider's console.

    <Frame caption="Enter credentials in Supabase">
      <img src="/images/build/connectors/supabase/social-auth/supabase-google-provider-settings-light.webp" alt="Supabase Google provider settings including fields for Client ID, Client Secret, and Redirect URL." className="theme-image light-image" />
      <img src="/images/build/connectors/supabase/social-auth/supabase-google-provider-settings-dark.webp" alt="Supabase Google provider settings including fields for Client ID, Client Secret, and Redirect URL." className="theme-image dark-image" />
    </Frame>

    <Note>
      Always copy the callback URL directly from Supabase.
      Each provider requires a unique format, and typos will break the flow.
    </Note>

    The provider appears as enabled in your Supabase list.
  </Step>

  <Step title="Test sign-in in your Rocket app">
    1. Launch your Rocket app to get the live preview URL.
    2. Open the live preview or your custom domain (not localhost).
    3. Click **Sign in with [Provider]**.
    4. Complete the provider's login flow.

    You are redirected back to your Rocket app and signed in successfully.
  </Step>

</Steps>

## Troubleshooting [#troubleshooting]

### 1. OAuth error after clicking sign-in [#1-oauth-error-after-clicking-sign-in]

Clicking the provider button opens an OAuth error page.

- Check that the **Authorized redirect URI** in the provider's console matches the Supabase callback exactly.
- Ensure the **Authorized JavaScript origins** includes your Rocket live preview or custom domain.

### 2. Redirected but not logged in [#2-redirected-but-not-logged-in]

After login, you are redirected but remain unauthenticated.

- Confirm Rocket is linked to the Supabase project where the provider is enabled.
- Test only using your live preview link or custom domain, not localhost.

<Card icon="users" horizontal title="Social sign-in done right">
  You have successfully added social authentication to your Rocket app using Supabase.
</Card>
