To make the QR code verification work on your phone, you need to configure the system to use your laptop's IP address instead of localhost.
# Server Configuration
PORT=5000
NODE_ENV=development
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/college-events
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRE=7d
# CORS Configuration
FRONTEND_URL=http://192.168.170.146:5173
ADMIN_URL=http://192.168.170.146:5174Create or update frontend/vite.config.js:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0', // Allow external connections
port: 5173
}
})VITE_API_URL=http://192.168.170.146:5000/apicd backend
npm run devBackend will run on: http://192.168.170.146:5000
cd frontend
npm run devFrontend will run on: http://192.168.170.146:5173
- Register for an event on your laptop
- Get the QR code from My Registrations page
- Scan QR code with phone - it should redirect to:
http://192.168.170.146:5173/verify-registration?eventId=...&userId=... - Phone will show the verification page with user details
- Check Network: Ensure phone and laptop are on same WiFi
- Check Firewall: Windows Firewall might block connections
- Check Ports: Ensure ports 5000 and 5173 are open
- Test URL: Try opening
http://192.168.170.146:5173on phone browser
- Open Windows Defender Firewall
- Click "Allow an app or feature through Windows Defender Firewall"
- Add Node.js and allow it for both Private and Public networks
- Or temporarily disable firewall for testing
If 192.168.170.146 doesn't work, try:
192.168.1.x(common home network range)10.0.0.x(some router configurations)- Check your actual IP with
ipconfigcommand
The QR code will contain URLs like:
http://192.168.170.146:5173/verify-registration?eventId=123&userId=456
This allows anyone on the same network to scan and verify registrations without needing to log in.