Review our guidelines to safeguard your applications and integrations.
ownid-signature
, is a hash value that the OwnID server generates from a timestamp and the body of the request. The second one, ownid-timestamp
can be used by your backend to calculate the signature that is based on the timestamp and request body, and then compare the result to the value of ownid-signature
. If both signatures do not match, the request has been altered.
Because the signatures are generated using an HMAC with the SHA256 hash function, the OwnID server and your backend must use the same cryptographic key when calculating the hash value. You can obtain this key from the OwnID Console, and then add the code generates a hash and compares it to the signature in your backend.
Obtaining the HMAC Key
Before the backend can generate the HMACSHA256 value, you must obtain the secret cryptographic key used in the calculation. Simply open your OwnID application in the OwnID Console and copy the value from MyApp > Shared Secret.
Request Verification
Now that you have the cryptographic key, the backend can verify requests by generating each request’s expected signature and compare it to the one generated by the OwnID server. The backend code must:
ownid-signature
and ownid-timestamp
headers from the request. These headers provide the HMAC code generated by the OwnID server and the timestamp it used to generate it.
ownid-timestamp
for expiration.
To prevent replay attacks, check whether the provided timestamp is within an acceptable time window. Define a preferred expiration time, such as 1 minute, and validate against the current time. Requests with a timestamp older than this period should be rejected.
.
ownid-timestamp
header)ownid-signature
header.
*.ownid.com
in the rule definitions for specific policies for them to function properly.
An example rule set would look similar to the following: