npm.io
1.0.13 • Published 2 years ago

liquid-node-connector

Licence
MIT
Version
1.0.13
Deps
0
Size
8 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

Liquid Node Connector

A Node.js connector library to integrate your microservices with Liquid authentication services. This library requires Node version 18 or above.

Installation

Run npm i liquid-node-connector.

Usage
Initialization
import LiquidConnector from "liquid-node-connector";

const liquidConnector = new LiquidConnector({
  host: "host_address_of_your_liquid_instance",
  clientId: "your_liquid_client_id",
  clientSecret: "your_liquid_client_secret",
  scope: "scope1,scope2,scope3",
  // Optional
  cacheOptions: {
    client: RedisClient,
    expire: 300, // 5 minutes
  },
  // Optional
  logger: console, // Or any other logger that has debug, info, warn and error functions.
});
Authenticate a user connecting to your microservice
const user = await liquidConnector.authenticate(token);
// Now use this user info for the rest of your logic.
Get access token for accessing client level APIs
const { accessToken } = await liquidConnector.getAccessToken();
// Make APIs calls that requires client authentication.