Docs/Base Module/Supabase Login

Supabase Login

Authenticate with the Supabase CLI to manage your project from the terminal.

Using Cursor, Windsurf, or AI Tools?
AI coding assistants cannot open browsers for OAuth login. You'll need to use an access token instead. See the "AI-Assisted Setup" section below.

Manual Setup (Browser Login)

If you're setting up manually in a terminal, the simplest method is browser-based login:

supabase login

This opens your browser to authenticate. Once approved, you'll be logged in.

AI-Assisted Setup (Access Token)

When using AI tools like Cursor or Claude, you need to provide an access token because these tools cannot open browsers.

Step 1: Generate an Access Token

  1. Go to supabase.com/dashboard
  2. Click your profile icon in the top-right corner
  3. Select "Access Tokens" from the dropdown
  4. Click "Generate New Token"
  5. Give it a name (e.g., "CLI Access")
  6. Copy the generated token immediately (you won't see it again)
Keep Your Token Secret
Never commit access tokens to Git or share them publicly. They provide full access to your Supabase account.

Step 2: Login with Token

Use the --token flag:

supabase login --token YOUR_ACCESS_TOKEN

Replace YOUR_ACCESS_TOKEN with the token you copied.

Verify Login

Confirm you're logged in by listing your projects:

supabase projects list

You should see a list of your Supabase projects. If you get an authentication error, try logging in again.

Troubleshooting

"Token is invalid or expired"

Generate a new token from the Supabase dashboard. Tokens can expire or be revoked.

"Browser didn't open"

If running in a headless environment or AI tool, use the token-based login method instead.