Track Usage with Supabase/Firebase
Partner Backend->>ARES API: Send HMAC-signed request (email + client_id + timestamp)
ARES API-->>Partner Backend: Allow/deny access + remaining credits
Partner Backend-->>Partner Frontend: Proceed/block actionStep 1: Configure .env File
ARES_CLIENT_ID=your_client_id
ARES_CLIENT_SECRET=your_client_secret
# ... existing environment variables ... Step 2: Configure generateSignature Function
export function generateSignature(
clientSecret: string,
email: string,
timestamp: string
) {
const payload = `${email}|${timestamp}`;
return crypto
.createHmac("sha256", clientSecret)
.update(payload)
.digest("hex");
}Step 3: Create a Function to Access User's Information on ARES
Example Response from calling the GET method defined above:
Step 4: Create a Function to Track User's Usage
Example Response from the POST method of the route:
Example: Button that costs 1 credit to click
Last updated