Skip to content

sayan404/secure-jwt-auth-test-api

Repository files navigation

secure-jwt-auth



Setup

git clone https://github.com/sayan404/secure-jwt-auth-test-api.git

cd secure-jwt-auth-test-api

npm install

npm run dev

Usage

Encoding a JWT

Note: Although timeToLive, audience, issuer is an optional parameter, we set a 1-hour validation for the token by default.

To encode a JWT, use the genToken method:

import { genToken } from 'secure-jwt-auth';

const token = genToken(SECRET, id , payload , timeToLive , audience , issuer);

Decoding a JWT

To decode a JWT, use the decodeToken method:

import { decodeToken } from 'secure-jwt-auth';

const decoded = decodeToken(SECRET, token);

Validating a JWT

To validate a JWT, use the validateToken method:

import { validateToken } from 'secure-jwt-auth';

const isValid = validateToken(SECRET, token);

API Playground

Explore and interact with the secure-jwt-auth package using the API Playground set up for testing. You can experiment with encoding, decoding, and validating JWTs through the following link:

Feel free to test various endpoints and see how the package functions in different scenarios and if something weired occurs please feel free to reach out to me at [email protected].

About

sayan404/simpler-jwt-auth api link

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published