Authentication
Ensuring Secure and Authenticated API Requests Using HMAC SHA256.
Last updated
Ensuring Secure and Authenticated API Requests Using HMAC SHA256.
Last updated
To ensure the security and integrity of your API requests, you need to sign your requests using .
This process involves creating a specific string from your request, and then generating a signature using your secret key.
Requirement: Request an API Key and Secret Key from Tyga Support at support@tygapay.com to access APIs.
This guide provides a clear process for signing an API request, from converting a JSON body to a query string (handling nested fields with a dot .
), constructing the string to sign, and finally signing it using HMAC SHA256.
This ensures your API requests are secure and authenticated.
Depending on your programming language, use the following methods to convert a JSON object to a query string. Note that nested fields are handled using a dot (.
).
FULL URL:
https://api.com/users?test=xxx
API PATH:
/users?test=xxx
QUERYSTRING FROM BODY:
field1=value2&nestedField.nestedField1=nestedValue1
Construct the string to sign by concatenating the API PATH and the QUERYSTRING FROM BODY:
stringToSign = "/users?test=xxxfield1=value2&nestedField.nestedField1=nestedValue1"
Use your programming language's libraries to sign the string using HMAC SHA256.