A Node.js connector library to integrate your microservices with Liquid authentication services. This library requires Node version 18 or above.
Run npm i liquid-node-connector
.
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.
});
const user = await liquidConnector.authenticate(token);
// Now use this user info for the rest of your logic.
const { accessToken } = await liquidConnector.getAccessToken();
// Make APIs calls that requires client authentication.