Authentication
For our reseller partners, we have a dedicated method for authentication. This method is based on two custom headers, CN-Reseller-Token
and CN-Reseller-Tenant-ID
.
The CN-Reseller-Token
is a unique token assigned to each of our reseller partners. This is used to authenticate the reseller's requests to the API.
The CN-Reseller-Tenant-ID
is an additional identifier that the reseller partner supplies. It should be a unique identifier for each end-user or site that the reseller is managing. This ensures that each end-user only has access to their own resources.
Here is an example of how to use these headers in a request:
Example Request:
- curl
- Node.js
curl -H "CN-Reseller-Token: ACCESS_TOKEN" -H "CN-Reseller-Tenant-ID: UNIQUE_TENANT_ID" "https://api.commoninja.com/platform/api/v1/widgets"
const axios = require('axios');
async function getData() {
const response = await axios.get('https://api.commoninja.com/platform/api/v1/widgets', {
headers: {
'CN-Reseller-Token': 'ACCESS_TOKEN',
'CN-Reseller-Tenant-ID': 'UNIQUE_TENANT_ID'
},
});
return response.data;
}
getData();
Obtaining your CN-Reseller-Token
As a reseller partner, you will be provided with a unique CN-Reseller-Token
when you join our program. In order join our program, please apply here.
Defining a CN-Reseller-Tenant-ID
The CN-Reseller-Tenant-ID
is defined by the reseller partner. It should be a unique identifier for each end-user or site that the reseller is managing.
The CN-Reseller-Tenant-ID
you choose should not change once set, as it is used to track the user or site's resources.
Using Reseller Access for API Requests
When you make an API request on behalf of an end-user or a site, you should include both the CN-Reseller-Token
and the CN-Reseller-Tenant-ID
in the headers of your request.
The CN-Reseller-Token
authenticates you as a valid reseller partner, while the CN-Reseller-Tenant-ID
scopes the request to the specific end-user's or site's resources.