Tim Butterfield
Authenticate Your Twitter App - OAuth

With Twitter's new API, not only have they removed open access to public Twitter timelines, you're expecting developers to contend with cryptic authentication documentation!

Many of us simply want to display our own tweets on our own website, but its obvious Twitter prefers us to use their widgets. Despite the convoluted Twitter instructions, implementing OAuth in your lovingly-crafted API 1.0 application is reasonably straight-forward if you use the libraries provided by talented group of (non-Twitter) developers.

The steps below will show how to obtain with OAuth keys from a Twitter App for use on your website.

Step 1: Create Your Twitter Application

Head to dev.twitter.com/apps/ and log in using your Twitter ID and password. This can be any account; your application will be able to read any other users timeline without their knowledge or permission. Bare in mind, your application will be connected to the user's timeline and can be blocked if the user wishes to.

Click the Create a new application button and enter the name and description of your application. The website should be a page where you can download your code but, since youre still writing it, enter your home page URL and change it later. Leave the callback URL blank.

Complete the CAPTCHA and click Create.

Step 2: Create an Access Token

Click the Create my access token button at the bottom of the Details tab on your application's page. You'll now see various strings against:

  1. OAuth: Consumer key
  2. OAuth: Consumer secret
  3. Token: Access token
  4. Token: Access token secret

Keep the page open youll need these shortly.

Step 3: Add to your Twitter plugins

$consumerkey = '11111111';
$consumersecret = '22222222';
$accesstoken = '33333333';
$accesstokensecret = '44444444';

The variables $consumerkey, $consumersecret, $accesstoken and $accesstokensecret must be set to the Twitter codes generated in Step 2 above.

See Twitter feed on website article for uses.

This is based on Craig Buckler's article found here.

[koken_upload filename="easily-display-tweets-with-twitter-api-11-on-wordpress.png" label="easily-display-tweets-with-twitter-api-11-on-wordpress.png"]