Skip to content

Implement authentication with Passport #7

Description

@he-james

Description
From Nest docs, Authentication
Authentication is an essential part of most applications. There are many different approaches and strategies to handle authentication. The approach taken for any project depends on its particular application requirements. This chapter presents several approaches to authentication that can be adapted to a variety of different requirements.

Passport is the most popular node.js authentication library, well-known by the community and successfully used in many production applications. It's straightforward to integrate this library with a Nest application using the @nestjs/passport module. At a high level, Passport executes a series of steps to:

Authenticate a user by verifying their "credentials" (such as username/password, JSON Web Token (JWT), or identity token from an Identity Provider)
Manage authenticated state (by issuing a portable token, such as a JWT, or creating an Express session)
Attach information about the authenticated user to the Request object for further use in route handlers

UC

  • As a User, I want to log into Nexus securely, in order to use the
    product safely and without a lot of hassle.

AC

  • Follow the Nest authentication tutorial to do this
  • The endpoint /auth/login must allow a user to be authenticated correctly
  • The endpoint must return a user object and a status code
  • User models must be defined in Nest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions