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');
- OpenStreetMap full & tested with iD
- GitHub - partial, full flow is not possible because
access_token
API is not CORS-enabled
// make an oauth request.
ohauth.xhr(method, url, access_token, 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' }