Twitter authentication setup
Things you will need before you start:
- A Twitter account. If your Twitter profile doesn't have your current mobile number associated with it, you will need to add your mobile number in order to create your new app as part of the process.
Follow each of these steps:
1. Go to the Twitter development homepage: https://developer.twitter.com/
2. If you're not already signed in to Twitter, click on Sign In in the top right corner of the page. You can sign in with your normal Twitter account. (It may take you to your Twitter home page when you sign in. If so, return to https://developer.twitter.com/ once you're logged on.)
4 Click "Apply for a Developer Account" in the middle of the page.
5 The next page asks "What is your primary reason for using Twitter developer tools?" and gives you a lot of options. Click Student, which is in the third column.
6 On the next page, under "what would you like us to call you", put "CDSW_student".
7 Next, Twitter will ask you about your plans. Please follow these instructions carefully to make sure Twitter approves your application.
In the field "In your words":
I am taking a Community Data Science course at the University of Washington. My instructors are Mako Hill (firstname.lastname@example.org), Tommy Guy (email@example.com), and Dharma Dailey (firstname.lastname@example.org). You can find our workshop details at https://wiki.communitydata.science/Community_Data_Science_Workshops_(Winter_2020).
Under "The Specifics" check yes for "Are you planning to analyze Twitter data" and enter the following text:
We are learning to download Twitter data and do basic analysis. For instance, we will try to determine whether an earthquake has happened recently or whether there is a basketball game going on.
Uncheck the sliders for "Will your app use Tweet, Retweet, like, follow, or Direct Message functionality?" and all other options.
8 Click "next" in the lower right then click "Looks good" on the review page. Finally, accept the terms of service and click "Submit Application" on the next page.
9 Twitter will send an email to the account you used. Click "Confirm your email" in that email to finish setup.
If you have any trouble with the steps before this, email us before Saturday. If you have trouble on the next steps, we'll be able to help you on Saturday.
10 When you confirm in the email, you will arrive at https://developer.twitter.com/en/account/get-started. On that page, click "Create an app". This will take you to https://developer.twitter.com/en/apps
11 Click "Create an app", which takes you to https://developer.twitter.com/en/apps/create. You'll need to fill in a few details about your app.
App name: "CDSW Sample"
Application Description: "Sample application for the CDSW workshop."
Callback URLs: "https://www.example.com"
Leave "Enable Sign in with Twitter" unchecked.
The next few fields are not needed, but scroll to the bottom to find "Tell us how this app will be used".
Tell us how this app will be used: "Learning data science with python in the Community Data Science workshop. This app is for testing purposes only."
Finally, click create, and click create again in the modal window.
- Almost there!!*
12 In the next step, you will access Twitter credentials, which will let you authenticate with Twitter in python.
You should be at a page that looks like:
Click the "Keys and Tokens" tab. You will see a box called "Consumer API keys" with two long strings labeled "API key" and "API secret key". You should copy and paste those into a text file on your desktop.
Finally, click "Generate" which will open a modal with two new strings called "Access Token" and "Access Token Secret". Copy these two keys to the same file and close the modal.
You will need all four of these strings in order to have your Twitter application work.
Keep this material secret. Your access token and access token secret will allow anybody who has it to post to Twitter as you and to control your account. It is equivalent to your Twitter username and password so please be as careful with it as you would be with your Twitter password!