![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
A most-of-the-way OAuth 1.0 client implementation in Javascript. Meant to be an improvement over the default linked one because this uses idiomatic Javascript.
If you use this on a server different from the one authenticated against, you'll need to enable and use CORS for cross-origin resources. CORS is not available in IE before version IE10.
Try it out at: http://osmlab.github.io/ohauth/
As a file
wget https://raw.github.com/osmlab/ohauth/gh-pages/ohauth.js
With browserify
npm install ohauth
var ohauth = require('ohauth');
access_token
API is not CORS-enabled// generates an oauth-friendly timestamp
ohauth.timestamp();
// generates an oauth-friendly nonce
ohauth.nonce();
// generate a signature for an oauth request
ohauth.signature("myOauthSecret", "myTokenSecret", "percent&encoded&base&string");
// make an oauth request.
ohauth.xhr(method, url, auth, data, options, callback);
// options can be a header like
{ header: { 'Content-Type': 'text/xml' } }
ohauth.xhr('POST', url, o, null, {}, function(xhr) {
// xmlhttprequest object
});
// generate a querystring from an object
ohauth.qsString({ foo: 'bar' });
// foo=bar
// generate an object from a querystring
ohauth.stringQs('foo=bar');
// { foo: 'bar' }
// create a function holding configuration
var auth = ohauth.headerGenerator({
consumer_key: '...',
consumer_secret: '...'
});
// pass just the data to produce the OAuth header with optional
// POST data (as long as it'll be form-urlencoded in the request)
var header = auth('GET', 'http://.../?a=1&b=2', { c: 3, d: 4 });
// or pass the POST data as an form-urlencoded
var header = auth('GET', 'http://.../?a=1&b=2', 'c=3&d=4');
1.0.1
FAQs
Pure-browser OAuth for CORS-supporting sites like OpenStreetMap
The npm package ohauth receives a total of 151 weekly downloads. As such, ohauth popularity was classified as not popular.
We found that ohauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.