@deep/nest-kit
    Preparing search index...

    Class BaseJwtService<U, RT>

    JwtService is a service that provides functionality for generating, verifying, and refreshing JSON Web Tokens (JWTs) in a NestJS application.

    It can be used to generate access and refresh tokens for users and then verify those tokens when they are presented to the application. In addition, the JwtService can refresh an expired access token with a valid refresh token, and it can delete a refresh token from the database when it is no longer needed.

    The service uses a secret key to sign and verify the tokens, and it can be configured to expire the tokens after a certain period of time. With JwtService, NestJS applications can implement secure authentication and authorization for users.

    Type Parameters

    Index

    Constructors

    Properties

    dataSource: DataSource
    idService: IdService
    jwtConfig: JwtConfigType
    loggerFactory: WinstonLoggerFactory
    usersService: BaseUsersService<U>

    Accessors

    • get repository(): Repository<RT>

      Returns Repository<RT>

    Methods

    • Delete refresh token from database

      Parameters

      • id: string

        refresh token id

      Returns Promise<void>

    • Delete refresh token from database

      Parameters

      • userId: string

        user id for which to delete refresh tokens

      Returns Promise<void>

    • Returns string

    • Returns void

    • Generate new access and refresh tokens

      Parameters

      Returns Promise<UserTokens>

      = user tokens

    • Check if refresh token is valid

      Parameters

      Returns Promise<RT>

      • refresh token
      • UnauthorizedException if refresh token expired or invalid