What is Twitter oAuth all about?

oAuth as defined on Twitter is

OAuth is an authentication protocol that allows users to approve application to act on their behalf without sharing their password

This would allow customers to give access to their accounts on 3rd party websites to service providers who would use that access to provide the service the customer is looking from them.

For example, a store owner is looking for an economical way to market his products to customers through some social networking medium (in this case Twitter). In return the store owner can give some discount to the customer for indirectly marketing their store or products to his relatives and friends. All of this can happen without the customer ever having to provide account information to the store owner.

The customer would just have to go to Twitter, log into his account and allow access to the application. Twitter will then provide access token to the application which can then be used by it to access the customer account and act on behalf of it.

oAuth is a wonderful technique being used by Twitter and I see huge potential of its use in the future as it provides an economical way to market products and services.

I have recently developed a module in OsCommerce which allows a store owner to provide some discount to the customer provided he tweets on the store and its products on Twitter.

How to display tweets from Twitter on your website?

If you tweet a lot on Twitter and wish to display them on your website or blog then you can do that easily with the following code


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, “http://twitter.com/statuses/friends_timeline.xml”);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, “<username>:<password>”);

$str = curl_exec($ch);

echo $str;


Once you get your tweets you can then customize the look and feel accordingly or save them in the database. Please note that you will need to enter the username and password of your Twitter account other wise the above will not work.

Hope the above helped