📝Json Web Token
The module provides a service that allows you to create and verify JSON Web Tokens.
Imports
Environment Variables
name
description
JWT_SECRET
Secret for Json Web Token.
Write .env
file with environment variable. Below has an example:
.env
Method of Use
To use this module, you need to inject it into the desired service.
Injecting the module into our service.
With dependencies
You will need to inject the following interfaces.
Interface
Service
IConfigurationService
IValidatorRegexpService
IStringExService
Methods
Method
Scope
Description
save
public
It takes a payload, a secret, and an expiration time, and returns a signed JWT.
load
public
It takes a token and a secret and returns the payload of the token or an error.
Last updated