Create a Twitter application
First things first, you’ll need to create a Twitter application, that contains the needed api tokens and secrets.
Follow these 6 steps:
Visit Twitter Developer Portal, login and select Apps from the menu:
Create a new app
- Give it a name and description
- Important: Select Enable Sign in with Twitter and add the following url to the list of Callback URLs:
http://127.0.0.1:3000/twitter/callback
- In your app settings, head over to Keys and Tokens
- Get your Consumer API key and Consumer API secret key and copy them to your clipboard, you’ll need them in the code
Now you have everything you need to authenticate through the Twitter API with Node.js!