oauth-1.0a is a JavaScript library providing a streamlined way to authorize requests using the OAuth 1.0a protocol in both Node.js and browser environments. It abstracts away the complexities of generating `oauth_consumer_key`, `oauth_nonce`, `oauth_signature`, and other OAuth 1.0a parameters, allowing developers to use their preferred HTTP client (e.g., `request`, `jQuery.ajax`). The current stable version is 2.2.6, with minor updates addressing dependency bumps and TypeScript type improvements. A key differentiator is its separation of cryptographic hashing, requiring users to provide a `hash_function` implementation, which allows for flexibility with native Node.js `crypto` or browser-specific libraries like CryptoJS. It aims to simplify integration with popular OAuth 1.0a services like Twitter, Flickr, and Bitbucket.
npm install oauth-1.0aVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `oauth-1.0a` library for Node.js, configure a SHA1 hash function using `node:crypto`, and generate authorization data for a sample GET request. It shows how to obtain the authorization header required for sending authenticated requests to OAuth 1.0a services.
Update your consumer object to use `key` instead of `public`. Implement a custom `hash_function` using `node:crypto` for Node.js or a browser-compatible crypto library.
Ensure your Node.js environment includes the `crypto` module. If not, consider a different hash function implementation or environment.
Include a client-side crypto library (e.g., CryptoJS) in your project and configure `oauth-1.0a` to use its hashing functions.
Use default import syntax: `import OAuth from 'oauth-1.0a'`.
Change `import { OAuth } from 'oauth-1.0a'` to `import OAuth from 'oauth-1.0a'`.Verify that your Node.js installation includes the crypto module. If using a bundler (like Webpack for browser), ensure `node:crypto` is correctly polyfilled or stubbed, or provide a browser-specific `hash_function`.
Ensure that `consumer.key` and `consumer.secret` are valid, non-empty strings in the configuration object passed to `OAuth()`.
No dependency data recorded yet.