Self-hosted TOTP authenticator PWA with FIDO2 (WebAuthn)
Go to file
soruly 42aca0ebce
Init
2022-06-16 08:28:12 +00:00
.github Init 2022-06-16 08:28:12 +00:00
static Init 2022-06-16 08:28:12 +00:00
.env.example Init 2022-06-16 08:28:12 +00:00
.gitignore Init 2022-06-16 08:28:12 +00:00
.prettierrc.json Init 2022-06-16 08:28:12 +00:00
CODE_OF_CONDUCT.md Init 2022-06-16 08:28:12 +00:00
LICENSE Init 2022-06-16 08:28:12 +00:00
README.md Init 2022-06-16 08:28:12 +00:00
ecosystem.config.json Init 2022-06-16 08:28:12 +00:00
index.ejs Init 2022-06-16 08:28:12 +00:00
package-lock.json Init 2022-06-16 08:28:12 +00:00
package.json Init 2022-06-16 08:28:12 +00:00
server.js Init 2022-06-16 08:28:12 +00:00

README.md

2FA

License GitHub Workflow Status

Self hosted 2-factor authentication PWA

Features

  • Installable PWA
  • (TBC) Display timeout indicator
  • (TBC) Scan QR Code instead of manual input
  • (TBC) Show QR Code for copying to other devices

Getting Started

Prerequisites: nodejs >= 16

git clone https://github.com/soruly/2fa.git
cd 2fa
npm install
node server.js

Note: In order for PWA to work, you must host the server behind a reverse proxy (like nginx) with HTTPS

Example nginx config:

location / {
  proxy_set_header Host $host;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection upgrade;
  proxy_buffering off;
  proxy_cache off;
  proxy_pass http://127.0.0.1:3000;
}

Environment Variables

  • Copy .env.example to .env
  • Edit .env as you need
SERVER_PORT # (optional) Default: 3000
SERVER_ADDR # (optional) Default: 127.0.0.1

Run by pm2

You also can use pm2 to run this in background.

Use below commands to start / restart / stop server.

npm run start
npm run stop
npm run reload
npm run restart
npm run delete