Currently Available: Need a skilled Software Developer for your next project?
Categories
APIs

Webhook Authentication: What Integrators Need to Know

When a provider sends an HTTP request to your service because an event occurred, your receiver has to decide whether to accept that request and which integration sent it. That kind of event-driven HTTP request is called a webhook. Before you connect a webhook, your team and the provider need a contract that spells out how the receiver identifies the provider, whether the sender must authenticate to the endpoint, and which credential or trust mechanism both sides will use.

Your contract also needs to keep endpoint authentication separate from signed-payload validation. When your receiver checks endpoint authentication, it decides whether the caller has permission to send a request to the receiving URL. A payload signature is data attached to the delivery. When your receiver checks that signature, it verifies that the provider created the message and that nobody altered the signed content. Because providers implement these two controls in different ways, you should describe them separately.

How the receiver identifies the provider

Your receiver needs a reliable way to tie each incoming request to a specific integration before it routes or authorizes the delivery. You can give each provider account its own callback path or configuration record. If several integrations share a single endpoint, your contract should state which validated credential or token claim maps each request to the right provider or account.

Event headers can tell your receiver how to handle a delivery, but they never prove who sent it. GitHub documents X-GitHub-Event as event context and separately recommends using a webhook secret to validate deliveries. Your receiver should read event names and similar headers for routing only after the agreed trust checks pass.

A hard-to-guess callback URL does not authenticate the caller either. OWASP describes webhook endpoints as public and unauthenticated unless the implementer adds authentication. Write down exactly what your receiver checks before it accepts a request.

Whether the sender must authenticate to the endpoint

Some providers authenticate as HTTP clients before your receiver accepts a delivery. Others attach a signed payload without offering separate endpoint authentication for that delivery mode. Always check the documentation for the specific product and delivery configuration instead of assuming every webhook works the same way.

For example, Twilio supports OAuth 2.0, Basic, and Digest authentication when it sends webhook requests to an integrator’s server. Google Cloud Pub/Sub authenticated push subscriptions place a signed OpenID Connect (OIDC) token in the Authorization header. OIDC is a token format that carries an identity your receiver can verify. Your receiver checks the token’s identity claim and audience claim, and the audience (which names the intended recipient) must match the value configured for that subscription. Keep in mind that these examples apply only to those products and configurations.

Your contract should state whether the receiver requires authentication on the inbound HTTP request, which credential or token it accepts, and how it responds when a request leaves that credential out or sends an invalid value. If multiple integrations share an endpoint, spell out how the receiver maps a validated identity to the right provider account.

Naming the credential and how both sides handle it

Name the provider’s exact authentication method in the contract rather than writing a vague phrase like "secure webhook" when an implementer needs to know what to configure. Basic authentication sends a username and password, while Digest is a separate HTTP authentication method. OAuth client credentials let a provider request an access token, and an API key is a credential sent directly with a request. A provider-issued OIDC token carries signed identity claims that your receiver verifies.

Different products tie credentials to their own platform settings. For Google Pub/Sub authenticated push, the subscription’s selected service account and audience are part of the authentication setup, and Google specifies a permission that the Pub/Sub service agent needs to create tokens for that account. For AWS EventBridge API destinations, AWS supports Basic, API key, and OAuth authorization and stores connection authorization parameters in Secrets Manager. Because these setups vary by product, your contract should name who provisions and maintains the credentials, where they live, and how both sides handle rotation and revocation.

Keep credentials out of callback URLs whenever the provider gives you another option. Twilio still supports Basic and Digest credentials embedded in webhook URLs as a legacy option, but its security guidance warns that URL credentials can leak into logs or source control. GitHub likewise advises against putting sensitive credentials in a payload URL. Your receiver should also keep Authorization headers and secrets out of its own logs, as recommended by the OWASP Webhook Security Cheat Sheet.

Require HTTPS to protect credentials and webhook traffic in transit. HTTPS encrypts the connection, though it does not by itself tell your receiver which provider sent the request. GitHub recommends HTTPS with SSL verification enabled for deliveries. Treat transport encryption and sender identity as separate requirements in your contract.

Keeping signed-payload validation separate

A shared webhook secret lets your receiver verify a signature without acting as a login credential for the endpoint. Your receiver uses that secret to check whether the provider created the delivery and whether anyone changed the signed content. GitHub documents this use of a secret separately from HTTP endpoint authentication.

Twilio draws the same line. Its HTTP authentication controls whether Twilio can call your endpoint, while its signature checks request integrity. You can use those two controls separately or together over HTTPS. If you document signature construction and verification mechanics elsewhere, leave them out of the authentication contract and state only what the signature is for and which deliveries require it.

A source IP allowlist limits which network addresses can connect to your server, but it does not give you a per-request credential or cryptographic proof. GitHub notes that operators can fetch its delivery IP addresses from its metadata endpoint, and those addresses can change, so operators have to keep the list up to date. Treat an IP allowlist as an extra layer of filtering rather than your only proof of who sent the request.

Documenting failures and operational limits

Write down what your receiver does when authentication fails, and make sure both sides agree on that behavior. For OAuth-based deliveries, state who refreshes credentials and what happens when a token expires or gets revoked. AWS EventBridge, for instance, documents token refresh behavior for its API destinations, though you cannot assume other senders follow the same rules.

Account for provider-specific delivery limits as well. GitHub expects receivers to return a 2XX response within 10 seconds of receiving a delivery; if your receiver takes longer, GitHub closes the connection and marks the delivery as failed. That 10-second deadline applies to GitHub, so check the timeout rules for whatever provider you integrate with. For related delivery behavior, see how to isolate webhook failures.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *