Subscribe To Okta Status Webhook Notifications
Last Updated:
Overview
Administrators can configure an endpoint to receive an HTTP POST request whenever Okta creates, updates, or resolves an incident. The webhook URL requires specific configuration, Okta IP addresses require allowlisting, and the HMAC signature requires verification to ensure secure delivery.
How is a webhook subscription configured?
- Open Okta Status and sign in as an Administrator of your Okta org.
- Open the Subscribe menu and select the Webhook tab.
- Enter your webhook URL and select the cells you want notifications for.
- Select Subscribe.
The webhook URL must meet specific requirements.
-
Start with
https://and be 255 characters or fewer; - Use port 443 and resolve to a public IP address (private and internal addresses are rejected);
- Respond with a
2xxstatus within 10 seconds. Redirects are not followed.
NOTE: Each user can have one webhook URL.
Signing key
You will use this key to verify deliveries, as described below.
Which Okta IP addresses require allowlisting?
If your endpoint is behind a firewall or only accepts traffic from known sources, allow inbound HTTPS from these IP addresses. Webhook requests are sent only from:
52.34.146.5252.32.155.19054.202.111.145
Verify the HMAC signature
Every delivery is signed with your signing key using HMAC-SHA256, so you can confirm that the message came from Okta and was not modified in transit.
Request headers
| Header | Description |
| X-Okta-Trust-Signature | The signature, in the form v1=<hex digest>. |
| X-Okta-Trust-Timestamp | Unix time in seconds at which the request was signed. |
| X-Okta-Trust-Event-Id | Unique ID of the event. Use it to ignore duplicate deliveries. |
| X-Okta-Trust-Event-Type | The type of event. |
| X-Okta-Trust-Secret-Version | Version of the signing key used for this request. |
How the signature is computed
signed_payload = timestamp + "." + raw_request_body
signature = "v1=" + hex( HMAC_SHA256(signing_key, signed_payload) )
timestamp is the value of the X-Okta-Trust-Timestamp header, and raw_request_body is the body exactly as received. Do not parse and re-serialize the JSON before computing the HMAC, or the result will not match.
Verification steps
- Read the timestamp and signature headers and the raw request body.
- Reject the request if the timestamp differs from your current time by more than 5 minutes (300 seconds). This protects against replayed requests.
- Compute the expected signature as shown above using your signing key.
- Compare it with the
X-Okta-Trust-Signatureheader using a constant-time comparison. Reject the request if they differ.
Code examples
Node.js
const crypto = require("crypto");
function isValid(signingKey, headers, rawBody) {
const timestamp = headers["x-okta-trust-timestamp"];
const received = headers["x-okta-trust-signature"];
const age = Math.abs(Date.now() / 1000 - Number(timestamp));
if (!(age <= 300)) return false;
const expected = "v1=" + crypto
.createHmac("sha256", signingKey)
.update(timestamp + "." + rawBody)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(received || "");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
Python
import hmac, hashlib, time
def is_valid(signing_key: str, headers: dict, raw_body: bytes) -> bool:
timestamp = headers["X-Okta-Trust-Timestamp"]
received = headers.get("X-Okta-Trust-Signature", "")
if abs(time.time() - int(timestamp)) > 300:
return False
signed_payload = timestamp.encode() + b"." + raw_body
expected = "v1=" + hmac.new(
signing_key.encode(), signed_payload, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, received)
Java
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public static boolean isValid(String signingKey, String timestamp,
String received, byte[] rawBody) throws Exception {
long age = Math.abs(System.currentTimeMillis() / 1000 - Long.parseLong(timestamp));
if (age > 300) {
return false;
}
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(signingKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
mac.update((timestamp + ".").getBytes(StandardCharsets.UTF_8));
byte[] digest = mac.doFinal(rawBody);
StringBuilder hex = new StringBuilder("v1=");
for (byte b : digest) {
hex.append(String.format("%02x", b));
}
return MessageDigest.isEqual(
hex.toString().getBytes(StandardCharsets.UTF_8),
received.getBytes(StandardCharsets.UTF_8));
}
Go
package webhook
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"math"
"strconv"
"time"
)
func IsValid(signingKey, timestamp, received string, rawBody []byte) bool {
ts, err := strconv.ParseInt(timestamp, 10, 64)
if err != nil || math.Abs(float64(time.Now().Unix()-ts)) > 300 {
return false
}
mac := hmac.New(sha256.New, []byte(signingKey))
mac.Write([]byte(timestamp + "."))
mac.Write(rawBody)
expected := "v1=" + hex.EncodeToString(mac.Sum(nil))
return hmac.Equal([]byte(expected), []byte(received))
}
C#
using System;
using System.Security.Cryptography;
using System.Text;
public static bool IsValid(string signingKey, string timestamp, string received, byte[] rawBody)
{
var age = Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - long.Parse(timestamp));
if (age > 300)
{
return false;
}
var prefix = Encoding.UTF8.GetBytes(timestamp + ".");
var payload = new byte[prefix.Length + rawBody.Length];
prefix.CopyTo(payload, 0);
rawBody.CopyTo(payload, prefix.Length);
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(signingKey));
var expected = "v1=" + Convert.ToHexString(hmac.ComputeHash(payload)).ToLowerInvariant();
return CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(expected),
Encoding.UTF8.GetBytes(received ?? ""));
}
PHP
<?php
function isValid(string $signingKey, array $headers, string $rawBody): bool
{
$timestamp = $headers['X-Okta-Trust-Timestamp'] ?? '';
$received = $headers['X-Okta-Trust-Signature'] ?? '';
if (abs(time() - (int) $timestamp) > 300) {
return false;
}
$expected = 'v1=' . hash_hmac('sha256', $timestamp . '.' . $rawBody, $signingKey);
return hash_equals($expected, $received);
}
Ruby
require "openssl"
def valid?(signing_key, headers, raw_body)
timestamp = headers["X-Okta-Trust-Timestamp"].to_s
received = headers["X-Okta-Trust-Signature"].to_s
return false if (Time.now.to_i - timestamp.to_i).abs > 300
expected = "v1=" + OpenSSL::HMAC.hexdigest("SHA256", signing_key, "#{timestamp}.#{raw_body}")
expected.bytesize == received.bytesize && OpenSSL.fixed_length_secure_compare(expected, received)
end
Bash
# Compute the expected signature for a saved request body (for local testing)
SIGNING_KEY="your-signing-key"
TIMESTAMP="1700000000" # X-Okta-Trust-Timestamp header
BODY_FILE="body.json" # raw request body, exactly as received
printf '%s.' "$TIMESTAMP" | cat - "$BODY_FILE" \
| openssl dgst -sha256 -hmac "$SIGNING_KEY" -hex \
| sed 's/^.* /v1=/'
# Compare the output with the X-Okta-Trust-Signature header.
What are common troubleshooting steps for webhook deliveries?
- Signatures never match: check that you are hashing the raw body (not re-serialized JSON) and the exact signing key you were given.
- Timestamp rejected: make sure your server clock is synchronized (NTP).
- Not receiving requests: confirm the three IP addresses above are allowed and that your endpoint returns
2xxwithin 10 seconds. If deliveries fail, we may notify you by email.
