Code Monkey home page Code Monkey logo

study-jwtauth-example-nestjs's Introduction

NestJS JWT Authentication

Description

  • Passport is a library for authentication in Nodejs.
  • Passport recognizes Strategy to validate a given information.
  • After the successful authentication, Passport attaches the additional user information to the request.
  • Passport-local is a strategy of Passport and it uses { username, password } to authenticate the users.
  • By default, variable names must be same to be readable by PassportStrategy.
  • If you want to modify the above fields, use the options { usernameField, passwordField }.

Database is needed to maintain the user information for authentication.

Main Dependency

Passport

$ npm install --save @nestjs/passport passport passport-local
$ npm install --save-dev @types/passport-local

JWT

$ npm install --save @nestjs/jwt

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Swagger

Follow below link after running to understand codes in Swagger playground.

http://localhost:9000/api

Reference

[1] Base Repository

[2] NestJS JWT Authentication

[3] NestJS 노트 (2) : Guards

[4] NestJS 노트 (3) : Authentication

[5] Nestjs 프로젝트에 Swagger 도입하기

study-jwtauth-example-nestjs's People

Contributors

hubts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.