# 🔑 GET GMAIL APP PASSWORD NOW ## The Problem: ``` SMTP authentication failed Username and Password not accepted ``` **This means:** You're using your **regular Gmail password**, but Gmail requires an **App Password** for SMTP. --- ## ✅ FIX IN 4 STEPS: ### Step 1: Enable 2-Factor Authentication (If Not Already) 1. Go to: **https://myaccount.google.com/security** 2. Find **"2-Step Verification"** 3. If it says "Off", click **"Get started"** 4. Follow the steps to enable 2FA (you'll need your phone) **⚠️ You MUST have 2FA enabled to create App Passwords!** --- ### Step 2: Create Gmail App Password 1. **Go to App Passwords:** - Direct link: **https://myaccount.google.com/apppasswords** - Or: Google Account → Security → 2-Step Verification → App passwords 2. **Sign in** with: `noreply.buildmate@gmail.com` 3. **Create App Password:** - **Select app**: Click dropdown → Choose **"Mail"** - **Select device**: Click dropdown → Choose **"Other (Custom name)"** - **Enter name**: Type **"BUILDMATE"** - Click **"Generate"** button 4. **Copy the Password:** - Google shows: `abcd efgh ijkl mnop` (16 characters with spaces) - **Remove all spaces**: `abcdefghijklmnop` - **Copy it immediately** - you'll only see it once! --- ### Step 3: Update .env.local Open `.env.local` in VS Code and find: ```env SMTP_PASSWORD=Buildmate123 ``` **Replace with:** ```env SMTP_PASSWORD=abcdefghijklmnop ``` (Use your actual 16-character App Password, no spaces) **Make sure your `.env.local` looks like this:** ```env SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=noreply.buildmate@gmail.com SMTP_PASSWORD=your_16_char_app_password_here SMTP_FROM_EMAIL=BUILDMATE SMTP_FROM_NAME=BUILDMATE ``` --- ### Step 4: Restart Server 1. **Stop server**: Press `Ctrl+C` in terminal 2. **Start server**: Run `pnpm dev` --- ## ✅ After Fixing: Try registering again. You should see: ``` ✅ SMTP connection verified successfully ✅ Email sent successfully via Supabase SMTP ``` And you'll receive the verification code in your Gmail inbox! --- ## ❌ Common Mistakes: 1. **Using regular password**: `SMTP_PASSWORD=your_regular_password` ❌ - **Fix**: Must use App Password 2. **Keeping spaces**: `SMTP_PASSWORD=abcd efgh ijkl mnop` ❌ - **Fix**: Remove spaces: `abcdefghijklmnop` 3. **2FA not enabled**: Can't create App Password ❌ - **Fix**: Enable 2-Factor Authentication first 4. **Not restarting**: Changed `.env.local` but didn't restart ❌ - **Fix**: Must restart server after changes --- ## 🔍 Verify It's Working: After updating and restarting, check terminal: - ✅ Should see: `✅ SMTP connection verified successfully` - ✅ Should see: `✅ Email sent successfully` - ❌ If still error: Check App Password is correct (16 chars, no spaces) --- ## 🆘 Troubleshooting: ### "App passwords aren't available" - **Solution**: Enable 2-Factor Authentication first - Go to: https://myaccount.google.com/security ### "Still getting authentication failed" - **Check**: App Password is 16 characters (no spaces) - **Check**: SMTP_USER is full email: `noreply.buildmate@gmail.com` - **Check**: Server was restarted after updating `.env.local` - **Try**: Create a new App Password ### "Can't find App passwords option" - Make sure 2FA is enabled - Try direct link: https://myaccount.google.com/apppasswords - Or: Security → 2-Step Verification → App passwords (scroll down) --- ## 📋 Quick Checklist: - [ ] 2-Factor Authentication enabled - [ ] Went to https://myaccount.google.com/apppasswords - [ ] Created App Password (Mail → Other → BUILDMATE) - [ ] Copied 16-character password - [ ] Removed spaces from password - [ ] Updated `.env.local` with App Password - [ ] Saved file (Ctrl+S) - [ ] **Restarted server** (Ctrl+C, then `pnpm dev`) - [ ] Tested registration --- ## 💡 Remember: - ❌ `SMTP_PASSWORD=Buildmate123` = Regular password (won't work) - ✅ `SMTP_PASSWORD=abcdefghijklmnop` = App Password (works!) **Gmail requires App Password for SMTP - regular passwords don't work!**