Skip to content

bigcommerce-token-validator 1.0.0

Install from the command line:
Learn more about npm packages
$ npm install @space48/bigcommerce-token-validator@1.0.0
Install via package.json:
"@space48/bigcommerce-token-validator": "1.0.0"

About this version

BigCommerce Token Permissions Audit Tool

Node.js CI

This tool is designed to help you audit your BigCommerce store's token permissions. It will generate a report that shows which endpoints are accessible with the token you provide.

You can use this tool to determine which permissions are carried by your token, and which permissions are missing. This can be useful when you are trying to determine why a particular API call is failing.

Install

Add the following line to your .nmprc file:

@space48:registry=https://npm.pkg.github.com/space48

Run npm install @space48/bigcommerce-token-validator to install the package.

Then, import the DoAudit function and pass it your credentials and the permissions you want to test.

Usage

import { DoAudit, BigCommercePermission } from '@space48/bigcommerce-token-validator';

const creds = {
    clientId: '',
    accessToken: '',
    storeHash: '',
};
const results = await DoAudit(creds, [
    BigCommercePermission.All,
]);
console.log(results);

Results

[
 
    {
        "message": "{\"status\":403,\"title\":\"You don't have a required scope to access the endpoint\",\"type\":\"https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes\",\"errors\":{}}",
        "permission": "store_v2_customers",
        "result": false,
        "status": 403,
    },
    {
        "message": undefined,
        "permission": "store_v2_customers_read_only",
        "result": true,
        "status": 200,
    },
    {
        "message": undefined,
        "permission": "store_v2_information_read_only",
        "result": true,
        "status": 200,
    },
    ...
]

Testing

Run cp .env.example .env and fill in the values for your store.

Run npm run test to run the tests.

Contributing

Please feel free to submit a pull request if you have any improvements or bug fixes.

Details


Assets

  • bigcommerce-token-validator-1.0.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all