Overview
Request Signature
Overview
Request Signature
Thanx suggests that you provide a signature with every request.
Thanx will validate this signature. This is an extra security feature that provides a guarantee that a request was not tampered with on its way from client to server.
-
Assemble the components of the string that will be signed:
- Client ID
- Request method (GET, POST, PATCH, PUT, DELETE)
- Content Type (same as the header value or empty string if no body)
- The request body (empty string if no body)
- The request path
-
Base64 encode the body after creating a digest using SHA-256.
-
Join these strings together, with a comma separator.
-
Create a digest using HMAC & SHA-256.
-
Base64 encode the digest.
-
This value is your signature header.
See examples to the right.
stringToSign = string.Join(
",",
ClientId,
HttpVerb,
HttpContentType,
Base64(SHA256(HttpBody)),
UriPathAndQuery
)
signature = Base64(HMAC-SHA256(ClientSecret, UTF8(stringToSign)))
stringToSign = string.Join(
",",
ClientId,
HttpVerb,
HttpContentType,
Base64(SHA256(HttpBody)),
UriPathAndQuery
)
signature = Base64(HMAC-SHA256(ClientSecret, UTF8(stringToSign)))