0.2 Twitter credentials

The book uses Twitter data for a few exercises. I use the excellent rtweet package for accessing Twitter API. You will need an approved developer Twitter account and a functional Twitter app. Mike Kearly, the author of rtweet has a detailed post about how to set up an app and get the secret keys. you can follow it here: https://rtweet.info/articles/auth.html. However, the post is a bit old and the screenshots don’t look like the current Twitter menu. Although all his instructions are still valid, in this section I am showing you current screenshots.2

Step 1. Visit https://developer.twitter.com/ and request an account.

Apply for Developer Account

Figure 0.1: Apply for Developer Account

Step 2. Once you get the approval, log into the new account and click on your user name on top right to display menu. Click on “Apps”.

Display the Menu for Apps

Figure 0.2: Display the Menu for Apps

Step 3. Click on “Create an app” button.

Create an App

Figure 0.3: Create an App

Step 4. Fill in your app details. All the required fields need to be filled up.

Fill in App Details

Figure 0.4: Fill in App Details

Step 5. You will need to provide the following callback URL: http://127.0.0.1:1410.

Provide Callback URL

Figure 0.5: Provide Callback URL

Step 6. Describe how you plan to use this app. “Data collection for academic research and teaching” is a valid use.

Planned App Use

Figure 0.6: Planned App Use

Step 7. After setting up the app, verify the app details.

Check App Details

Figure 0.7: Check App Details

Step 8. Note down the API keys and access tokens. You will need these for accessing the Twitter API.

Keys and Tokens

Figure 0.8: Keys and Tokens


  1. As of May 15, 2019