A complete implementation of FIDO2/WebAuthn authentication experience from scratch.
- Passwordless Authentication: Complete FIDO2/WebAuthn implementation
- Modern UI: Clean, responsive React frontend
- Secure Backend: Node.js/Express server with proper WebAuthn handling
- Cross-Platform: Works with various authenticators (fingerprint, security keys, etc.)
- WebAuthn server implementation using @simplewebauthn/server
- RESTful API endpoints for registration and authentication
- In-memory user storage (can be extended to use databases)
- CORS and security middleware
- Modern, responsive UI built with React
- WebAuthn client implementation using @simplewebauthn/browser
- Real-time authentication status updates
- Support for multiple authenticators per user
- Node.js (v16 or higher)
- npm or yarn
- A modern web browser with WebAuthn support
- An authenticator device (fingerprint reader, security key, etc.)
- Install all dependencies:
npm run install-all
- Start the development servers:
npm run dev
This will start:
- Backend server on http://localhost:3005
- Frontend development server on http://localhost:3008
npm run build
npm start
-
Registration Flow:
- Enter a username
- Click "Register with FIDO2"
- Follow your device's authentication prompts
- Your authenticator will be registered
-
Authentication Flow:
- Enter your username
- Click "Authenticate with FIDO2"
- Use your registered authenticator
- You'll be authenticated
- Attestation: Verifies authenticator legitimacy
- Assertion: Validates authentication attempts
- Challenge-Response: Prevents replay attacks
- Origin Validation: Ensures requests come from authorized domains
- User Verification: Supports biometric and PIN verification
- Chrome 67+
- Firefox 60+
- Safari 14+
- Edge 18+
fido2/
├── server/ # Backend server
│ ├── index.js # Main server file
│ ├── routes/ # API routes
│ └── utils/ # Utility functions
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API services
│ │ └── utils/ # Utility functions
│ └── public/
└── package.json
POST /api/register/begin
- Start registration processPOST /api/register/finish
- Complete registrationPOST /api/authenticate/begin
- Start authentication processPOST /api/authenticate/finish
- Complete authenticationGET /api/user/:username
- Get user information
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details