Authentication
ReResell uses NextAuth.js v5 for secure authentication.
Sign Up
Users can create an account with:
- Email and Password - Traditional registration
- Google OAuth - One-click sign up with Google
Email Registration
- Navigate to
/register - Enter name, email, and password
- Password must be at least 6 characters
- Account is created immediately
Google Sign Up
- Click "Continue with Google"
- Select your Google account
- Account is created automatically
Sign In
Email Sign In
- Navigate to
/login - Enter email and password
- Redirected to homepage on success
Google Sign In
- Click "Continue with Google"
- Select your Google account
- Redirected to homepage on success
Protected Routes
These routes require authentication:
| Route | Description |
|---|---|
/dashboard | User dashboard |
/listing/create | Create new listing |
/favorites | Saved listings |
/chat | Messages |
/profile | Edit profile |
/offers | Sent/received offers |
Unauthenticated users are redirected to /login with a callback URL.
Session Management
- Sessions use JWT tokens stored in HTTP-only cookies
- Sessions expire after 30 days
- Users can sign out from the header menu
User Profile
After authentication, users have access to:
- Name - Display name
- Email - Login email (cannot be changed)
- Profile Image - From Google or uploaded
- Bio - Optional description
- Location - Default meetup location
Security Features
- Password Hashing - bcrypt with salt rounds
- CSRF Protection - Built into NextAuth.js
- Secure Cookies - HTTP-only, secure in production
- OAuth State - Prevents CSRF on OAuth flows