Authentication

Set up Google OAuth and Magic Link authentication

MoveFast uses NextAuth.js (Auth.js) for authentication with two providers: Google OAuth and Magic Link.

Google OAuth

1. Create OAuth Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to APIs & Services > Credentials
  4. Click Create Credentials > OAuth client ID
  5. Select Web application

2. Configure Authorized Origins & Redirects

In the OAuth client settings, add the following:

Authorised JavaScript origins:

code
http://localhost:3000
https://yourdomain.com

Authorised redirect URIs:

code
http://localhost:3000/api/auth/callback/google
https://yourdomain.com/api/auth/callback/google

3. Add Environment Variables

Copy your Client ID and Client Secret to .env.local:

env
GOOGLE_CLIENT_ID="your-client-id"
GOOGLE_CLIENT_SECRET="your-client-secret"

Magic Link

Magic Link lets users sign in with just their email — no password required. A secure link is sent to their inbox.

To configure Magic Link, you need to set up an email provider. See the Email Setup guide for configuration.

Environment Variables

Add these auth-related environment variables to your .env.local:

env
AUTH_SECRET="KNYeQM56xQwZSoZWHlIelyX/Rypgo="
AUTH_TRUST_HOST=true
NEXT_PUBLIC_WEBSITE_URL=http://localhost:3000
VariableDescription
AUTH_SECRETSecret key for encrypting sessions. Generate your own for production.
AUTH_TRUST_HOSTSet to true to trust the host header. Required for most deployments.
NEXT_PUBLIC_WEBSITE_URLYour app's URL. Update this for production.

Tip: Generate a new AUTH_SECRET for production by running openssl rand -base64 32 in your terminal.