Before you start
Use Node.js 22 or later and your destination’s signing secret.Run the receiver
standardwebhooks package to verify signatures. Its receiver.js registers the raw-body handler before JSON parsing and verifies each signature before reading event fields.
OFAUTH_WEBHOOK_SECRET in .env to the destination’s signing secret, then start the receiver. Keep .env out of version control.
3001 without printing a startup message. A valid event returns 204 and prints its ID and type. An invalid or stale signature returns 400. To make this receiver reachable from OFAuth, follow Test webhooks locally. If you already run a public HTTPS receiver, continue at Add a destination.
Verify destination ownership
During destination verification, OFAuth sends a signed event withtype: "ofauth.webhook.challenge" and a challenge string. Verify its signature, then return that exact string as the text/plain response body with a 2xx status. Do not JSON-encode it or add a newline. The example receiver handles this before checking normal event fields.
Apply events to your application
Before accepting events that update your app, save them to a database or a queue that keeps data after a restart. UseeventId to detect duplicates so retries do not repeat an action. Keep sample test data out of customer records, and keep each environment’s state separate. Events about account and access changes have test: true in Test, even when they describe real accounts. See Test deliveries.
For linked-account events, use order to avoid applying older updates over newer ones. When an authorization changes, read its current linked-account list. Follow the account and access event list and activity catalog to select the event types your feature uses. After checking the signature, return success for event types you do not use.
Return a 2xx success response as soon as you save the event. Do longer work afterwards. OFAuth retries failed deliveries with a wait between attempts. See the delivery reference.
The sample verifies and logs deliveries. Before the receiver changes customer data, add storage and duplicate checks to your app. If saving fails, return an error so OFAuth can retry.
Troubleshoot deliveries
Start with the failing stage: reaching your receiver, verifying the signature, or updating application state. Record the HTTP status and processing stage in your receiver’s logs. After verification, includeeventId and type, without the signing secret or full event body.
The sample logs only the ID and type of accepted events. It does not log challenges or rejected requests. If you add request-stage logs, record statuses rather than secrets or bodies.
Check reachability separately
For a deployed copy of this sample, send an unsigned request to your endpoint:400 from this receiver because the signature is missing. That response confirms that the route is reachable and rejects unsigned requests. Use a signed sample event to test acceptance and Verify to test delivery from OFAuth.
Next, receive OnlyFans activity or handle account reconnects.