{"id":3075,"date":"2010-06-14T11:47:45","date_gmt":"2010-06-14T19:47:45","guid":{"rendered":"http:\/\/www.perivision.net\/wordpress\/?p=3075"},"modified":"2010-06-21T07:56:27","modified_gmt":"2010-06-21T15:56:27","slug":"twitter-going-to-oauth-only-in-2-weeks-you-have-been-warned","status":"publish","type":"post","link":"https:\/\/www.perivision.net\/wordpress\/2010\/06\/twitter-going-to-oauth-only-in-2-weeks-you-have-been-warned\/","title":{"rendered":"Twitter going to OAuth ONLY in 2 weeks.  You have been warned."},"content":{"rendered":"<p>{UPDATE}<\/p>\n<p>Well, seem with all the issues Twitter has been\u00a0 having lately they have pushed this back a month, perhaps 2.\u00a0 But dont get lacks, its going to happen, so you may as well get on it now.<\/p>\n<p>The end time are nigh.\u00a0 Yes, for all of us first gen Twitter App dev&#8217;s our old code is about to die on us.\u00a0 The old way of sending authentication using a users name and password will officially lose support july 1. That means you had better get OAuth (or XAuth) up and running before hand. I have a feeling a lot of mashups might find a few broken pieces on July1 and whole sites that are not really supported anymore could die altogether.<\/p>\n<p>Now replacing your old twitter class with one that supports OAuth is not all that bad.\u00a0 In fact, if you waited like I have, you will find its easier then when OAuth rolled out.\u00a0 In my case, I had an old library from Nick Beam (2007) that I have been updating, and decided to switch to a library from Abraham -&gt; <a href=\"http:\/\/github.com\/abraham\/twitteroauth\" target=\"_blank\">http:\/\/github.com\/abraham\/twitteroauth<\/a> that seems pretty straightforward to implement and use.\u00a0 Now, the issue I had to deal with was, how do I replace my existing library (which was build around username password) with this new library?\u00a0 My first thought was to simply update my old twitter.class file with the new class file from abraham.\u00a0 That turned out to be pretty messy.\u00a0 So the next best step?\u00a0 Simply move my existing function calls from the old class to the new one.\u00a0 For example, this was from the 2007 class.\u00a0 All I had to do to work with Abrahams library, was change the last line..<\/p>\n<p>function getMentions_test($format, $page = 0, $since_id=0) {<br \/>\n$api_call = sprintf(&#8220;statuses\/mentions.%s&#8221;, $format);<br \/>\nif ($page) {<br \/>\n$api_call .= sprintf(&#8220;?page=%d&#8221;, $page);<br \/>\n}<br \/>\nif ($since_id) {<br \/>\n$api_call .= sprintf(&#8220;?since_id=%d&#8221;, $since_id);<br \/>\n}<br \/>\n\/\/echo &#8216;api &#8216;.$api_call.'&lt;br&gt;&#8217;;<\/p>\n<p>\/\/return $this-&gt;APICall($api_call, true);<br \/>\nreturn $this-&gt;get($api_call);<br \/>\n}<\/p>\n<p>All I changed was the return $this-&gt;APICall() to return $this-&gt;get()<\/p>\n<p>Tada! Update pretty much done.\u00a0 Now there were some other things I had to change here and there, but that was about it.\u00a0 Of course, if you wrote your code NOT having your API calls to twitter as a separate class, well then perhaps this is a good time to revise you code eh?\u00a0 And I would get on it because again, you only have 2 weeks left.<\/p>\n<p>Here is the direct work from Twitter&#8230;.<\/p>\n<p>The majority of Tweets are sent or read on applications built by the  developer community. &#8230; Many developers have already  switched their applications over to use OAuth, and we&#8217;re here to help  for those who haven&#8217;t. If you are a developer and still need to make  this necessary change, you can read more about the OAuth transition and  the resources available to you on the <a href=\"http:\/\/dev.twitter.com\/pages\/auth_overview\">Twitter developers  website<\/a>.<\/p>\n<div class=\"SPOSTARBUST-Related-Posts\"><H3>Related Posts<\/H3><ul class=\"entry-meta\"><li class=\"SPOSTARBUST-Related-Post\"><a title=\"NewsSnacker &#8211; Twitter newsfeed on the Pebble watch\" href=\"https:\/\/www.perivision.net\/wordpress\/2014\/09\/newssnacker-twitter-newsfeed-on-the-pebble-watch\/\" rel=\"bookmark\">NewsSnacker &#8211; Twitter newsfeed on the Pebble watch<\/a><\/li>\n<li class=\"SPOSTARBUST-Related-Post\"><a title=\"Your Twitter app suddenly does not work with OAuth, could be your database\" href=\"https:\/\/www.perivision.net\/wordpress\/2014\/02\/your-twitter-app-suddenly-does-not-work-with-oauth-could-be-your-database\/\" rel=\"bookmark\">Your Twitter app suddenly does not work with OAuth, could be your database<\/a><\/li>\n<li class=\"SPOSTARBUST-Related-Post\"><a title=\"How to get the news on your pebble watch.  My first little hack\" href=\"https:\/\/www.perivision.net\/wordpress\/2013\/12\/how-to-get-the-news-on-your-pebble-watch-my-first-little-hack\/\" rel=\"bookmark\">How to get the news on your pebble watch.  My first little hack<\/a><\/li>\n<li class=\"SPOSTARBUST-Related-Post\"><a title=\"Why did my Twitter app suddenly die?\" href=\"https:\/\/www.perivision.net\/wordpress\/2013\/06\/why-did-my-twitter-app-suddenly-die\/\" rel=\"bookmark\">Why did my Twitter app suddenly die?<\/a><\/li>\n<li class=\"SPOSTARBUST-Related-Post\"><a title=\"How to hack Facebook through OAuth\" href=\"https:\/\/www.perivision.net\/wordpress\/2013\/02\/how-to-hack-facebook-though-oauth\/\" rel=\"bookmark\">How to hack Facebook through OAuth<\/a><\/li>\n<\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>{UPDATE} Well, seem with all the issues Twitter has been\u00a0 having lately they have pushed this back a month, perhaps 2.\u00a0 But dont get lacks, its going to happen, so you may as well get on it now. The end time are nigh.\u00a0 Yes, for all of us first gen Twitter App dev&#8217;s our old&hellip; <a class=\"read-more\" href=\"https:\/\/www.perivision.net\/wordpress\/2010\/06\/twitter-going-to-oauth-only-in-2-weeks-you-have-been-warned\/\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[457,688,2342,691],"class_list":["post-3075","post","type-post","status-publish","format-standard","hentry","category-twitter","tag-api","tag-oauth","tag-twitter","tag-twitter-api"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pjzQD-NB","_links":{"self":[{"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/posts\/3075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/comments?post=3075"}],"version-history":[{"count":6,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/posts\/3075\/revisions"}],"predecessor-version":[{"id":3108,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/posts\/3075\/revisions\/3108"}],"wp:attachment":[{"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/media?parent=3075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/categories?post=3075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.perivision.net\/wordpress\/wp-json\/wp\/v2\/tags?post=3075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}