Header (Recommended)
We recommend checking all requests made to your API from our api server to validate the "authorization" header. We will be sending a sha256 hashed version of your api token, to check this see the code example below.
import { Router, Request, Response } from "express";
import hash from "crypto";
const WebhookToken = "YourTokenHere";
const hashedToken: string = hash.createHash("sha256").update(WebhookToken).digest("hex");
const router = Router();
router.post("/", async (req: Request, res: Response) => {
const { authorization } = req.headers;
if(hashedToken != authorization) return res.status(401).json({
error: "Unauthorized"
});
...
});
Last updated