Jump to content
Twitter Oauth Sample Code?
3 replies to this topic
Posted 19 May 2011 - 08:49 AM
I'm Ho. Does anyone have a sample code that implements OAuth to connect Twitter API? I tried Kevin Makice's uar_store_master_pw.php but Twitter API spitted out an error code of 401. I guess this is because Kevin's sample code is using basic authentication?
I'm really a novice in Twitter API application programming (I did some Perl programming to crawl Internet data and to parse it). In fact, I didn't know what API is even a week ago. But now I studied PHP and MySQL, purchased a webhosting service, and tried to test Kevin's code, all guided by Kevin's book. (Thanks Kevin! Your book is easy to understand even for a novice like me.) But now I'm stuck in (probably) OAuth. I tried to understand the OAuth scheme but it was not easy.
So, if anyone have a sample code or very easy document that explains how to implement OAuth, please let me know....
Thanks a lot!
Posted 30 May 2011 - 08:27 AM
The authentication in that code isn't applicable anymore, and hasn't been for several months. However, there are several nice wrappers for PHP to allow you to interact with OAuth easily. The one I usually point people to is Jaisen Mathai's Twitter-async:
There is some documentation there in the wiki and links to allow you to download that part of the code.
Posted 15 May 2013 - 06:01 AM
I have bought this book and spent the weekend typing up the 30 pages of code to create the twitter client designed by the author. However, the whole thing is based on an outdated process of users providing their username and password.
Twitter updated its security features some years ago, using a new system called oauth which, whilst mentioned in the book, isn't really addressed - even though the upgrade was due to take place shortly after this book was published.
Despite this topic being opened here a couple of years ago, and 4,500 views of it, the only response is a redirection to some general information on the auth protocol. After some days of wrestling with this I have now successfully completed oauthentication with twitter.
The following post (although not perfect - see the comments at the foot of the page) was helpful in achiving this:
But I am still at a loss as to how to adapt the various processes in the twitter client to make it work. For example, at least one of the tables in the database needs to be altered and many of the files rely on username and password when in fact we should be pulling in the users id in the database or perhaps their access tokens.
Is there a simple step by step guide on how to do this? Are you planning to create one?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users