How gitsneidig/rest-api-oauth-example works
Project type and purpose
• This is a lightweight backend “webhook authentication” microservice written in PHP.
• Its sole purpose is to accept incoming WooCommerce webhooks, look up the corresponding secret key in a database, compute or encode the expected signature, compare it with the incoming signature header, and then allow or reject the webhook.
File structure
• Top-level files:
• README.md – describes purpose and flow
• oauth-wc.php – single PHP script implementing the webhook endpoint, OAuth signature lookup, and comparison
• No separate frontend, no build scripts, no sub-modules.
• Implicit components: a relational database (e.g., MySQL) holding store/event → secret-key mappings; PHP runtime + web server; external WooCommerce stores triggering webhooks.
README for additional insights
• Incoming headers:
• x-wc-webhook-source: the store name (used as a DB key)
• x-wc-webhook-signature: the HMAC or encoded signature to verify
• Only “create” and “update order” events are processed; each event type has its own secret.
• On successful authentication, the payload can be forwarded to the multi-channel sales service (not shown in code but implied).