Generate Signature
Authenticating your request
Overview
signature
is an encrypted string that acts as a crucial part of the authentication process. It ensures and confirms the information included in the request is genuine and hasn't been modified. The user has to first generate a Signature Code and pass it through the request based on which the system detects and authenticates the request and provides a response. Any request with an invalid or unmatched Signature will be responded to as "Invalid/Unauthorized".
Generate signature
Here's a sample to generate a signature
:
SIGNATURE_KEY : 1234567890 // your signature key
let encode = base64encode(JSON.stringify(req.body));
encode = encode + "SIGNATURE_KEY";
let signature = sha256(encode);
function sha256(str) {
let hash = crypto.createHash("sha256")update(str).digest("hex");
return hash;
}
Note
signature
varies for every request and no two requests will have the same signature- ❌ In case of Signature Key mismatch, an "Unauthorized or Invalid" response will be reflected
- ⚠️ If the process encounters a technical error, the system will respond to the request as "Technical/Internal/Server Error"
Updated 8 months ago