To enable Google OAuth login/signup in DreamForge, follow these steps:
- Go to the Google Cloud Console
- Click "Select a project" → "New Project"
- Enter project name:
dreamforge-auth - Click "Create"
- In your Google Cloud Console, go to APIs & Services → Library
- Search for "Google+ API" or "People API"
- Click on it and press Enable
- Go to APIs & Services → OAuth consent screen
- Choose External user type → Create
- Fill in the required fields:
- App name:
DreamForge - User support email: Your email
- Developer contact email: Your email
- App name:
- Click Save and Continue
- On Scopes page, click Save and Continue
- On Test users page (if External), add your email, then Save and Continue
- Go to APIs & Services → Credentials
- Click + Create Credentials → OAuth 2.0 Client IDs
- Choose Web application
- Set the name:
DreamForge Web Client - Add Authorized redirect URIs:
- For development:
http://localhost:3000/api/auth/callback/google - For production:
https://dreamforge.vercel.app/api/auth/callback/google
- For development:
- Click Create
- Copy the Client ID and Client Secret
Add to your .env.local file:
# Google OAuth
GOOGLE_CLIENT_ID="your-client-id-here.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="your-client-secret-here"- Start your development server:
npm run dev - Visit
http://localhost:3000/auth/signin - You should see a "Continue with Google" button
- Click it to test the OAuth flow
- Ensure your redirect URI in Google Console exactly matches your app URL
- For local development, use
http://localhost:3000/api/auth/callback/google
- This is normal for development
- Click "Advanced" → "Go to DreamForge (unsafe)" to continue
- For production, you'll need to verify your app with Google
- Make sure you've added your email to test users in OAuth consent screen
- Or publish your app (if ready for production)
For production deployment on Vercel:
-
Add your production domain to authorized redirect URIs:
https://your-domain.vercel.app/api/auth/callback/google -
Set environment variables in Vercel dashboard:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETNEXTAUTH_URL=https://your-domain.vercel.appNEXTAUTH_SECRET=your-random-secret-key
- Never commit your client secret to version control
- Use different OAuth clients for development and production
- Regularly rotate your client secrets
- Keep your OAuth consent screen information up to date
You can also add GitHub OAuth by following similar steps:
- Go to GitHub → Settings → Developer settings → OAuth Apps
- Create a new OAuth App
- Add authorization callback URL:
http://localhost:3000/api/auth/callback/github - Add
GITHUB_IDandGITHUB_SECRETto your.env.local
The authentication system is already configured to handle multiple providers!