This is the backend service for the Migracon Study platform. It handles user authentication, including registration, login (email/password and Google OAuth), and password recovery features.
- 📥 Agent Registration (with hashed password and consent tracking)
- 🔐 Email & Password Login
- 🔁 Google Login (OAuth2)
- 📧 Forgot Password with OTP via Email
- ✅ OTP Verification
- 🔄 Reset Password using Verified OTP
-
Clone the repo
git clone https://github.com/sajjad-TL/Migracon-Study cd migracon-study-backend -
Install dependencies
npm install
-
Create a
.envfilePORT=5000 MONGO_URI=your_mongo_connection_string jwt_secret_key=your_jwt_secret GOOGLE_CLIENT_ID=your_google_client_id
-
Run the server
npm start
Server runs on:
http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new agent |
| POST | /api/auth/login |
Login with email/password |
| POST | /api/auth/google |
Login using Google OAuth |
| POST | /api/auth/forgot |
Request password reset OTP |
| POST | /api/auth/verify |
Verify OTP |
| POST | /api/auth/reset |
Reset password using OTP |
| Method | Endpoint | Description |
|---|---|---|
| POST | /student/add-new |
Add a new student |
| GET | /student/:studentId |
Get student ID |
| DELETE | /student/delete |
Delete a student by ID |
| PUT | /student/update-student |
Update student details by ID |
| Post | /student/:studentId/new-application |
Create a new application |
| Method | Endpoint | Description |
|---|---|---|
| PATCH | /agent/update |
Updated Agent by ID |
| GET | /:agentId |
Get Agent by ID |
| GET | /agent/all-students/:agentId |
Get all students for a specific agent |
MIT – feel free to use and modify.