In Chapter 7 of Head First HTML5 Programming, we create a JSONP web application called Tweetshirt. We use Twitter JSON data to create a tweet menu, so you can choose a tweet to add to a <canvas> element.
Unfortunately, Twitter has deprecated the public API that allows us to access a user’s timeline of tweets, and replaced it with an API that requires the user of the application accessing the timeline to authenticate first. This means the URL to access the JSON data of a Twitter user’s timeline on page 322 no longer works.
So you can use the example without having to write any complicated server-side code first, we have created a JSONP service that creates “fake tweets”. It behaves just like the old public Twitter API did, and returns an array of tweets, as a call to the callback you provide to the URL:
So if you’re implementing Tweetshirt as you read Head First HTML5 Programming, you can replace the URL on page 322 with the URL above and continue with the example as written in the book.
Web applications that need to access JSON data that requires authentication, such as data on Twitter or Facebook, can authenticate using a standard called OAuth. To learn how to use OAuth to create a server-side program to retrieve tweets and use it with the example in the book, read Using OAuth to access Twitter. OAuth is beyond the scope of Head First HTML5 Programming, but you’re welcome to try it on your own.
Thanks to chethStudios.net for the Tweetshirt icon.