All data endpoints are secured using a Basic authentication scheme. The authentication is build using the SiteId and ApiToken, that can be found in the integration tab of site settings on https://app.carts.guru.
Code samples
/* @description: create authorization header
** @params {{siteId: string, apiToken: string}} args -
** these parameters are available in the integration tab
** of the site settings
*/
const createAuthorizationHeader = ({ siteId, apiToken }) => {
// concatenate the siteId,timestamp, and hash
// with `:` as separator, and store it as base64 string
const authToken = `Buffer.from([siteId, apiToken].join(':')).toString('base64')`
return {
//
authorization: `Basic ${authToken}`
}
}