EndPointBlank for JavaScript and Node.js

Authorize service-to-service calls and report every request from an Express app. npm install end-point-blank-js and add two middleware.

Package
end-point-blank-js
Requires
Node.js 18 or later
Works with
Express

1. Install

Published on npm.

npm install end-point-blank-js

2. Configure and report every request

Use the client ID and secret of an application environment you created in EndPointBlank.

const epb = require('end-point-blank-js');
const { reportInteraction, reportInteractionErrorHandler } =
  require('end-point-blank-js/middleware');

epb.configure({
  clientId: process.env.ENDPOINTBLANK_CLIENT_ID,
  clientSecret: process.env.ENDPOINTBLANK_CLIENT_SECRET,
  appName: 'orders-service',
  environment: 'production',
});

app.use(reportInteraction);
app.use(routes);
app.use(reportInteractionErrorHandler); // after your routes

reportInteraction reports every request and response; the error handler, registered after your routes, captures anything they throw.

3. Protect a route

const { authorized } = require('end-point-blank-js/express');

router.get('/orders', authorized, listOrders);

authorized checks the caller against your grants and passes an UnauthorizedError to next() when it is refused. Allowed answers are cached in-process for cacheTtl seconds.

Next

The README covers every setting: masking rules, the authorization cache, authorizing outbound calls and the management API client. The quickstart walks through creating the application and credentials this page assumes.

Ready to deprecate with confidence?

Sign up in under a minute. No credit card, no sales call.