Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
cimpress-client-request
Advanced tools
A reference implementation of a cimpress.io API client embodied in a wrapped version of request
A module for handling generation of OAuth Bearer tokens issued by Auth0 by integrating credential management into request.js.
npm install cimpress-client-request
This module exposes a single method:
module.exports.refresh = function(config, cb) {}
This works as a drop-in replacement for request. Adopting this flow is as simple as these two surgical incisions:
//var request = require('request');
var request = require('cimpress-client-request');
// Note the set of 4 possible new options that can be passed in the request.js options.auth object.
// Every other property in the request options object works as normal, and you can call all of the
// convenience methods exposed by request.js.
var options = {
auth: {
client_id: 'see below',
client_secret: 'see below',
refresh_token: 'see below',
target_id: 'see below'
}
};
request(options);
Here's how you should use those 4 auth
parameters:
Property | Description |
---|---|
client_id | The client id you wish to use to request client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). |
client_secret | The client secret you wish to use to request client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). |
refresh_token | A refresh token for use in delegation flows, retrieved from developer.cimpress.io. Defaults to the environment variable CIMPRESS_IO_REFRESH_TOKEN . |
target_id | OPTIONAL The client id for which you are trying to retrieve a delegated token. Note, if you don't know this, you can rely on a 401 with a Www-Authenticate to provide the client id. If you don't provide this config, and the service doesn't provide that header, your call will fail with a 401. |
authorization_server | OPTIONAL The server to call to request client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). This defaults to https://cimpress-dev.auth0.com/oauth/token. |
audience | OPTIONAL The audience to send when requesting client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). This defaults to https://api.cimpress.io/ |
You might also want to look at our tests to see some examples of usage.
You can run tests via grunt
or grunt test
, but keep in mind that the tests are reliant on a few configurations that must be provided via environment variables:
Variable | Description |
---|---|
CIMPRESS_IO_REFRESH_TOKEN | A refresh token retrieved from developer.cimpress.io. |
CIMPRESS_IO_CLIENT_ID | The client id you wish to use to request client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). |
CIMPRESS_IO_CLIENT_SECRET | The client secret you wish to use to request client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). |
CIMPRESS_IO_TARGET_ID | The target ID used for delegation flows |
API_THAT_SUPPORTS_CLIENT_GRANTS | The URL for any GET endpoint on an API that supports client credential grants (https://auth0.com/docs/api-auth/grant/client-credentials). |
API_THAT_SUPPORTS_DELEGATION | The URL for any GET endpoint on an API that supports delegated tokens (https://auth0.com/docs/api-auth/grant/client-credentials). |
sudo apt-get install nodejs
If you are running Ubuntu you need to create a symlink for node. (There is a naming conflict with the node package).
sudo ln -s /usr/bin/nodejs /usr/bin/node
Install Grunt command line tool:
sudo npm -g grunt-cli
If you see an error about NPM not installed, run the following command to install:
sudo apt-get install npm
cd src/
sudo npm install
grunt
To package:
npm pack
This will generate a tarball gzipped following a file name convention of: <module>-<version>.tgz
To install:
npm install <path-to-tgz>
If you would like to run jslint and units tests before your commit then create a file in .git/hooks/pre-commit with execute permissions with the following content:
#!/bin/sh
grunt --gruntfile $(git rev-parse --show-toplevel)/src/Gruntfile.js
FAQs
A reference implementation of a cimpress.io API client embodied in a wrapped version of request
The npm package cimpress-client-request receives a total of 8 weekly downloads. As such, cimpress-client-request popularity was classified as not popular.
We found that cimpress-client-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.