This repository is based on my article here, creating a sample implementation of access and refresh tokens in NestJS.
The repository by no means covers every single topic or feature that you might desire in an application, but provides the most essential pieces of the implementation. This repository varies slightly from the article, using more directories and adding some additional configuration, but the idea is all the same.
Clone the repository and install the dependencies.
$ npm install
After doing so, you'll need to configure the database settings in src/application.module.ts
, as well as the JWT settings in both src/application.module.ts
and src/modules/authentication/strategies/jwt.strategy.ts
. In a production app, you should use Nest's config module to prevent exposing your secret variables, but this is merely an example of authentication - not necessarily configuration.
$ npm run start
Refer to the article for examples of using the API via curl
.