npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

oauth-1-client

v0.2.4

Published

Promise-based OAuth 1 client

Readme

oauth-1-client

Promise-based OAuth 1 client for node.js

Install

npm install oauth-1-client

Overview

Promise-based OAuth 1 client for node.js based on the node-auth library and client code from etsy-js.

Usage

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);

License

MIT