
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
cf-twitter-v1-oauth
Advanced tools
This package is no longer maintained
Simple and minimalist module to generate oAuth1.0a authorization header for Twitter API v1.1 and V2.
import dotenv from "dotenv";
dotenv.config();
import axios from "axios";
import oAuth1a from "twitter-v1-oauth";
const oAuthOptions = {
api_key: process.env.TWITTER_API_KEY || "",
api_secret_key: process.env.TWITTER_API_SECRET_KEY || "",
access_token: process.env.TWITTER_ACCESS_TOKEN || "",
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET || "",
};
const url = "https://api.twitter.com/1.1/search/tweets.json";
const method = "GET";
const params = { q: "twitter bot" };
const authorization = oAuth1a({ method, url, params }, oAuthOptions);
axios
.get(url, {
params,
headers: {
authorization,
},
})
.then(({ data }) => console.log(data))
.catch((err) => {
if (err.response) {
return console.log(err.response.data.errors);
}
console.log(err);
});
No dependencies and super small: .
npm install twitter-v1-oauth
Create an app and get your credentials, you will need:
Use your preferred library to send the request using the documented endpoints and parameters for the twitter v1 API.
When making a post request to Twitter API v1.1, the data needs to be encoded and sent as application/x-www-form-urlencoded
. The module exports an encode
function that can be used to properly encode the body before it is send. Check post-tweet for an example.
Whe making a post request to Twitter API v2, the data doesn't need to be encoded and must be sent as application/json
. Check like-v2 for an example.
const authRequest = require("twitter-v1-oauth").default;
import oAuthRequest from "twitter-v1-oauth";
Type definitions are included.
Check the examples directory for ideas on how to use it with axios.
The index.test.ts file should also provide a good idea on its usage.
FAQs
OAuth 1.0a authorization header for Twitter API
The npm package cf-twitter-v1-oauth receives a total of 0 weekly downloads. As such, cf-twitter-v1-oauth popularity was classified as not popular.
We found that cf-twitter-v1-oauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.