SecureAuthJWT is a package designed for generating, decoding, and validating JWT tokens.
- Generate JWT tokens
- Decode JWT tokens
- Validate JWT tokens
To generate a JWT token, follow these steps:
-
Use the
encode_jwt
function (Note: It is an asynchronous function). -
Pass the following parameters:
secret
: (string) The secret key used for encoding the token.id
: (string | number) The unique identifier for the token.payload
: (Payload) The payload data to be included in the token.ttl
: (number, optional) The time-to-live (TTL) for the token in seconds.aud
: (string, optional) The audience for the token.iss
: (string, optional) The issuer of the token.
-
The function will return a JWT token.
To generate a JWT token, follow these steps:
- Use the
decode_jwt
function (Note: It is an asynchronous function). - Pass the following parameters:
secret
: (string) The secret key used for encoding the token.token
: (string) The jwt token to be decoded.
- The function will return an object which would contain various used in the payload.
To generate a JWT token, follow these steps:
- Use the
validate_jwt
function (Note: It is an asynchronous function). - Pass the following parameters:
secret
: (string) The secret key used for encoding the token.token
: (string) The jwt token to be decoded.
- The function will return a boolean value.
Find us out on npm : https://www.npmjs.com/package/secureauthjwt
Try out the package : https://secureauthjwt.vercel.app/