1.0.12 • Published 5 years ago

nest-jwt-auth v1.0.12

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

npm npm

Nest JWT authentication

This package is meant to simplify adding JWT authentication to your Nest application. The package exposes a module which mounts an authentication endpoint at the /auth/token url.

Usage

Using this module is really simple, all you need to do is create a user implements the provided User and create a service that implements the provided UsersService and register the module in your application.

The recommended way to register the module is to inject your own UsersService implementation by using registerAsync but the module is flexible enough to support other solutions as long as the interface is implemented.

AuthModule.registerAsync({
  imports: [UsersModule],
  inject: [UsersService],
  useFactory: async (usersService: UsersService) => ({
    secretOrPrivateKey: "secretOrPrivateKey",
    usersService,
  }),
}),

Besides the users service it is possible to pass arguments for handling JWT, these arguments are the same as the arguments that you would use to register the JwtModule if you would implement JWT yourself.

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago