/index.js Secret
Created
January 28, 2025 05:09
Deno bug report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node/Bun | |
import { TwitterApi } from "twitter-api-v2"; | |
import "dotenv/config"; | |
const client = new TwitterApi({ | |
// these two values come from your app's API keys | |
appKey: process.env.TWITTER_APP_KEY, | |
appSecret: process.env.TWITTER_APP_SECRET, | |
// these two values come from the user's access tokens | |
accessToken: process.env.TWITTER_ACCESS_TOKEN, | |
accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET, | |
}); | |
console.log(await client.currentUserV2()); // Works fine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deno | |
import { TwitterApi } from "npm:twitter-api-v2"; | |
import "jsr:@std/dotenv/load"; | |
const client = new TwitterApi({ | |
// these two values come from your app's API keys | |
appKey: Deno.env.get("TWITTER_APP_KEY")!, | |
appSecret: Deno.env.get("TWITTER_APP_SECRET")!, | |
// these two values come from the user's access tokens | |
accessToken: Deno.env.get("TWITTER_ACCESS_TOKEN")!, | |
accessSecret: Deno.env.get("TWITTER_ACCESS_TOKEN_SECRET")!, | |
}); | |
console.log(await client.currentUserV2()); // Throws error on 2.1.5 and newer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment