A QR code authentication system built with Node.js, Express, and MongoDB. It allows users to generate a QR code for login and verifies the QR token to authenticate and log in the user.
- User registration and login
- QR code generation for login
- QR token verification for authentication
- MongoDB for data storage
- Clone the repository:
$ git clone https://github.com/Dev-29/elytra.git- Install dependencies:
npm install- Set up environment variables:
- Create a
.envfile the root directory of the project.the root directory of the project. - Add the following environment variables to the
.envfile: PORT=3000MONGODB_URI=mongodb://localhost:27017/qr_authJWT_SECRET=your-secret-key
- Start the mongod service:
mongod- Start the server:
npm start- Open postman tool
- Generate QR code:
Send a POST request to '
localhost:3000/auth/login':
{
"email": "example@gmail.com
}The response will contain a qrCodeUrl field with the URL of the generated QR code.
- Verify the QR code:
{
"qrToken": "<QR-TOKEN>"
}Replace <QR_TOKEN> with the value of the QR token displayed in the generated QR code.
- If the QR token is valid, you will receive a response with a success message indicating that the user is logged in.