Skip to content

project nestjs with 2fa + google authenticator support

License

Notifications You must be signed in to change notification settings

lo78cn/nestjs-2fa

 
 

Repository files navigation

Nestjs-2FA · mit license

Simple example of 2fa support in nestjs;

Based on nestjs authentication documentation

This project is compatible with Google Authenticator, and includes additional methods to allow you to work with insomnia API.

⚠️ NOTE: To test use chrome plugin

Install

to lib install

yarn

to run service

yarn start:dev

API:

Login

returns credentials

  • #POST /authentication/login

:payload:

{
	"email": "john@test.com",
	"password": "changeme"
}

2fa/generate

returns a base64 qrcode image to register in Google Authenticator

  • #POST /authentication/2fa/generate

2fa/authenticate

authenticate user from token

  • #POST /authentication/2fa/authenticate

:payload:

{
	"email": "john@test.com",
	"twoFactorAuthenticationCode": "188388"
}

2fa/token

create new token

  • #POST /authentication/2fa/token

:payload:

{
	"email": "john@test.com"
}

2fa/turn-on

  • #POST /authentication/2fa/turn-on

:payload:

{
	"email": "john@test.com",
	"twoFactorAuthenticationCode": "903927"
}

License

MIT

Copyright (c) 2022-present

About

project nestjs with 2fa + google authenticator support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.7%
  • JavaScript 5.3%