⚙️ Setup
Auth

Email & Google Auth Setup

This section provides a detailed explanation for setting up Email Auth and optionally enabling Google Auth using Supabase.

Configure Redirect URL

For any authentication provider you use, whether it's Email Auth or Google Auth, you need to set up the redirect URL as follows:

  1. Go to the URL Configuration (opens in a new tab) page in Supabase.

  2. Add the Site URL and Redirect URLs

    • Site URL: The base URL of your application
    • Redirect URLs: <base-url>/api/auth/callback (in our case)

    If testing locally, you can use http://localhost:3000 (opens in a new tab) as the base URL.

    Auth Redirect URL

Configure Environment Variable

Add the NEXT_PUBLIC_APP_URL to your .env.local file:

.env.local
NEXT_PUBLIC_APP_URL=<your-base-url>
# or
NEXT_PUBLIC_APP_URL=http://localhost:3000

Great! You've completed the setup. Now you can implement and use email authentication in your project.

Setup Google Auth

To enable Google login in your project, you need to configure the Google Auth Provider after you have completed the above steps.

For detailed steps on configuring OAuth Credentials in the Google Cloud Console and enabling the Auth Provider in the Supabase Dashboard, follow this documentation (opens in a new tab).

Here's a brief overview of the process:

  1. Set up a project in the Google Cloud Console (opens in a new tab).
  2. Configure OAuth Credentials for your application from the Google Console Dashboard.
  3. Enable the Google Auth Provider in the Supabase Dashboard (opens in a new tab).

Remember to securely store any client IDs or secrets provided during this process, and never expose them in your client-side code.