Carts Guru - Custom Integration
  • Carts Guru - Custom Integration
  • Carts Guru API
    • Contacts
    • Carts
    • Orders
  • Data APIs
    • Request Authentication
    • Contacts Api
      • Batch
  • Custom Integration
    • PHP SDK
    • Other language
  • FAQ
  • Ressources
Powered by GitBook
On this page
  • Token composition
  • Code samples
  1. Data APIs

Request Authentication

PreviousData APIsNextContacts Api

Last updated 5 years ago

Token composition

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 .

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}`
  }
}

https://app.carts.guru