O'Reilly Forums: Twitter Oauth Sample Code? - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Twitter Oauth Sample Code?

#1 User is offline   retinex2 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 19-May 11

Posted 19 May 2011 - 08:49 AM

Hi,

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!

Ho.
0

#2 User is offline   kmakice 

  • New Member
  • Pip
  • Group: O'Reilly Author
  • Posts: 4
  • Joined: 24-July 08
  • Gender:Male
  • Location:Bloomington, Indiana
  • Interests:Surviving graduate school

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:

https://github.com/j...i/twitter-async

There is some documentation there in the wiki and links to allow you to download that part of the code.
0

#3 User is offline   NickJohnson 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 24-September 12
  • Gender:Male

Posted 31 October 2012 - 09:18 PM

go to :- "dev.twitter.com" then to "docs" then "auth" then "oauth" then "single-user-with-examples"...
Here you will find the oauth codes....
http://www.expertsfromindia.com/html5-designer.htm
0

#4 User is offline   mercerjohn 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 15-May 13

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:

- http://net.tutsplus....-twitter-oauth/

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users