bbas-devicer - v0.2.1
    Preparing search index...

    Function createBbasMiddleware

    • Create an Express / Connect-compatible middleware that:

      1. Extracts BBAS context from the request and attaches it as req.bbasContext.
      2. In 'block' mode, calls the blockHandler (or sends 403) when the decision reaches 'block'.

      You must still pass req.bbasContext as the context argument when calling deviceManager.identify() for the enrichment to run.

      Parameters

      Returns (req: BbasRequest, res: ServerResponse, next: NextFunction) => void

      app.use(createBbasMiddleware(bbasManager, { mode: 'block' }));

      app.post('/identify', (req, res) => {
      const result = await deviceManager.identify(req.body, req.bbasContext);
      if (result.bbasDecision === 'challenge') { … }
      res.json(result);
      });