AuthVerse is a modular, backend-only authentication API built using Node.js, Express, MongoDB, and JWT.
This project implements a secure authentication based onEmail/Password-based authentication system, OAuth (Social Login (google, gitHub, facebook)), Magic Link Authentication, OTP based Login, Two-Factor Authentication(2FA)
- User Registration with hashed password
- User Login with JWT token
- JWT-based Protected Routes
- OAuth (Social Login(Google, gitHub, Facebook))
- Magic Link Authentication
- OTP Based Login
- Two-Factor Authentication(2FA)
- Basic Error Handling
- Clean Project Structure
- Node.js + Express
- MongoDB (via Mongoose)
- JWT (jsonwebtoken)
- bcryptjs for password hashing
- dotenv for environment configs
- express-validator (optional)
- Nodemailer (email sending)
- Passport.js (for OAuth)
git clone https://github.com/Robertgovind/AuthVerse.git
cd AuthVersenpm installPORT=4000
MONGO_URI=mongodb://localhost:27017/authverse
JWT_SECRET=your_jwt_secret
GOOGLE_ID=your_google_client_id
GOOGLE_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:4000/api/auth/google/callback
GITHUB_ID=your_github_client_id
GITHUB_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:4000/api/auth/github/callback
FACEBOOK_APP_ID=your_app_id
FACEBOOK_APP_SECRET=your_app_secret
FACEBOOK_CALLBACK_URL=http://localhost:4000/api/auth/facebook/callback
npm run dev
-
POST /api/auth/user/register
Body:{ "email": "", "password":"" } -
POST /api/auth/user/login
Body:{ "email": "", "password":"" }
-
Google based login
GET api/auth/google -
gitHub based login
GET api/auth/github -
Facebook based login
GET api/auth/facebook
-
For getting login email link
- POST api/auth/magic-link/request
-
After that use provided link that hits get request through browser
- GET api/auth/magic-link?token=dfsjdfhsdkjfhskdjhf