lengoo-auth-validator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Lengoo Auth Validator

Lengoo Auth Validator is a library that allows BFF projects to interact with the authentication service and validate a given token.

The token will be first retrieved from the authentication service and then cached in Redis. The key set in Redis will expire at the same expiration date of the token itself.

Usage

Set ENV variables:

AUTH_URL=http://localhost:3000/api
REDIS_URL=redis://localhost:6379

Import as following: import { validate, InvalidTokenError, TokenExpiredError } from 'lengoo-auth-validator';

Call the function validate(token) :

  • Returns the token payload
  • Throws InvalidTokenError if token invalid (wrong format)
  • Throws TokenExpiredError if token is expired

Readme

Keywords

none

Package Sidebar

Install

npm i lengoo-auth-validator

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

17.3 kB

Total Files

24

Last publish

Collaborators

  • daemyn