Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
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 i cimpress-client-request --save
or
yarn add cimpress-client-request
This module exposes a single method:
module.exports.request = 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 can specify your caching method by calling:
var request = require('cimpress-client-request');
var altCache = require('alternative-caching-library-here');
request.set_credentials_cache = altCache;
Note that the alternative caching method you use must support callbacks and have the following function definitions:
You might also want to look at our tests to see some examples of usage.
You can run tests via grunt
or grunt test
.
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 7 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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.