
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
oauth-1-client
Advanced tools
Promise-based OAuth 1 client for node.js
npm install oauth-1-client
Promise-based OAuth 1 client for node.js based on the node-auth library and client code from etsy-js.
Sample usage from a project using the ODesk API below.
var OAuth1Client = require('oauth-1-client');
var odeskClient = new OAuth1Client({
key: odeskConfig.apiKey,
secret: odeskConfig.sharedSecret,
callbackURL: odeskConfig.callbackURL,
requestUrl: 'https://www.odesk.com/api/auth/v1/oauth/token/request',
accessUrl: 'https://www.odesk.com/api/auth/v1/oauth/token/access',
apiHostName: 'www.odesk.com'
});
Note: The apiHostName
option is used to construct a base URL (https:// based) for all relative paths. See below.
Each method on the API returns back a Javascript promise object.
If using a version of node which supports ES6 generators, a sample usage might look like:
var response = yield odeskClient.requestToken();
var tempCredentials = {
token: response.token,
tokenSecret: response.tokenSecret
};
// Store `tempCredentials` somewhere and redirect user
// (there might be a URL provided in `response.authorizeUrl` - consult your OAuth provider docs).
Then in your OAuth callback:
var verifier = (get it from URL or request header depending on your provider);
var prevCredentials = (load previously stored credentials from above);
var response = yield odeskClient.accessToken(prevCredentials.token, prevCredentials.tokenSecret, verifier);
var finalCredentials = {
token: response.token,
tokenSecret: response.tokenSecret
};
// store `finalCredentials` somewhere
// Good to go now. Make sure to call .auth(...) function first to set the credentials:
var authODeskClient = odeskClient.auth(finalCredentials.token, finalCredentials.tokenSecret);
// Then use get/put/post/delte methods as you'd expect:
var relativeUrl = util.format('/gds/timereports/v1/providers/%s/hours', userRef);
var response = yield authODeskClient.get(relativeUrl, params);
MIT
FAQs
Promise-based OAuth 1 client
The npm package oauth-1-client receives a total of 9 weekly downloads. As such, oauth-1-client popularity was classified as not popular.
We found that oauth-1-client 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.