Recently, Twitter stopped allowing people to log in using plain HTTP Authentication, so we must use OAuth to authenticate ourselves. A full explanation of OAuth is out of the scope of this book, so we will use a library which makes it easy to use OAuth from Bash scripts. Perform the following steps:
- Download the bash-oauth library from https://github.com/livibetter/bash-oauth/archive/master.zip, and unzip it to any directory.
- Go to that directory and then inside the subdirectory bash-oauth-master, run make install-all as root.
- Go to https://apps.twitter.com/ and register a new app. This will make it possible to use OAuth.
- After registering the new app, go to your app's settings and change Access type to Read and Write.
- Now, go to the Details section of the app and note two things, Consumer Key and Consumer Secret, so that you can substitute these in the script we are going to write.
Great, now let's write the script that uses this.