Comments (1)
Hi @dvorsky.
I'm sorry for the late response.
Yes, this is expected behavior.
You cannot instantiate the client without providing all sets of keys.
The first time you're instantiating the client (to obtain the tokens), you need to use the credentials provided when you create the app on the developer.twitter.com platform.
Now, after you instantiate with those, you can make a call to oauthRequestToken
, to obtain the tokens.
const twitterClientAuthenticate = new TwitterClient({
apiKey: process.env.TWITTER_KEY,
apiSecret: process.env.TWITTER_SECRET,
accessToken: process.env.TWITTER_ACCESS_TOKEN,
accessTokenSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
});
const tokens = await twitterClientAuthenticate.basics.oauthRequestToken({
oauth_callback: 'https://call-back-url/callback',
});
Now, follow the authentication flow explained on the Twitter Documentation page.
Then instantiate a new client using the OAuth token and secret you obtained.
const twitterClient = new TwitterClient({
apiKey: process.env.TWITTER_KEY,
apiSecret: process.env.TWITTER_SECRET,
accessToken: oauth_token, // <- the one you obtained,
accessTokenSecret: oauth_token_secret // <- the one you obtained,
});
Now, you can use the second client instance client to do stuff with Twitter on the behalf of the authenticated user 😄
from twitter-api-client.
Related Issues (20)
- 403 on twitter.accountsAndUsers.accountUpdateProfileBanner() HOT 1
- Many methods won't work correctly without `stringify_ids` set to true HOT 1
- twitter-api-client should throw `Error`s, not objects
- `accountsAndUsers.friendshipsNoRetweetsIds()` returns Promise<unknown>
- Cannot use tweetsV2.searchAllTweets
- Using OAuth 2.0 as authorization to log in.
- Installation twitter-api-client HOT 3
- require
- Access token and secret required for pre-access token OAuth 1.0 steps HOT 4
- CORS Error HOT 3
- tweets.statusesHomeTimeline uses wrong StatusesHomeTimeline return type HOT 1
- How to make calls using Bearer token? HOT 1
- Include an example on how to upload an image with a tweet HOT 3
- Support for scheduling tweets HOT 1
- Deno Support
- `oauth_token` is a required parameter for the access_token endpoint HOT 2
- Parameters for TwitterClient.directMessages.eventsNew method is not clear in documentation HOT 1
- Can you edit your biography?
- how to only authenticate a request?
- StatusesHomeTimeline type missing retweeted_status property HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitter-api-client.