This project demonstrates how to implement Multi-Factor Authentication speakeasy and qrcode. It allows users to authenticate with MFA for more security.
- Clone this repository to your local machine.
- Install project dependencies with
npm install
in server paste.
Start the server with npm run dev
.
- Authentication
- Multi-Factor Authentication (MFA)
- Backend: Node.js, Express, swagger, speakeasy, qrcode with Javascript
- Database: PostgreSQL with Docker-compose
-
Installation:
-
Clone the repository:
git clone "https://github.com/Colledev/user-auth-mfa.git"
-
Navigate to the project directory:
cd user-auth-mfa
-
Install server-side dependencies (backend):
npm install
-
-
Configuration:
- Create a
.env
file in theserver
folder with necessary environment variables, such as database connection and SECRET_KEY.
- Create a
-
Execution:
-
Start the server (backend):
npm run dev
-
-
Access:
- Open the app in your browser using the address provided after starting the client (
http://localhost:3000
). - For better visualization, it is recommended to use the route
/api-docs/#/
(to use Swagger). - After creating a user, you can activate MFA by copying and pasting the JSON
qrCode
in the browser. - Using a mobile authenticator application, scan the QR code to verify the MFA.
MIT License.