Submit Search
Upload
TwitterKitではじめる OAuthスピードクッキング
•
Download as KEY, PDF
•
2 likes
•
2,232 views
Takashi Nojima
Follow
第2回CakePHP勉強会@福岡のLT発表資料です
Read less
Read more
Technology
Report
Share
Report
Share
1 of 31
Download now
Recommended
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012
Michael Peacock
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
21.search in laravel
21.search in laravel
Razvan Raducanu, PhD
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
Getting Started-with-Laravel
Getting Started-with-Laravel
Mindfire Solutions
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
Kris Wallsmith
PerlでWeb API入門
PerlでWeb API入門
Yusuke Wada
Perl5i
Perl5i
Marcos Rebelo
Recommended
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012
Michael Peacock
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
21.search in laravel
21.search in laravel
Razvan Raducanu, PhD
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
Getting Started-with-Laravel
Getting Started-with-Laravel
Mindfire Solutions
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
Kris Wallsmith
PerlでWeb API入門
PerlでWeb API入門
Yusuke Wada
Perl5i
Perl5i
Marcos Rebelo
優しいWAFの作り方
優しいWAFの作り方
techmemo
How to develop modern web application framework
How to develop modern web application framework
techmemo
Silex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
With a Mighty Hammer
With a Mighty Hammer
Ben Scofield
Mojolicious
Mojolicious
Marcos Rebelo
Storytelling By Numbers
Storytelling By Numbers
Michael King
Complex Sites with Silex
Complex Sites with Silex
Chris Tankersley
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
Javier Eguiluz
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
Design how your objects talk through mocking
Design how your objects talk through mocking
Konstantin Kudryashov
Rails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
Get into the FLOW with Extbase
Get into the FLOW with Extbase
Jochen Rau
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
Samuel ROZE
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
Michelangelo van Dam
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
Ryan Weaver
Алексей Плеханов: Новинки Laravel 5
Алексей Плеханов: Новинки Laravel 5
Oleg Poludnenko
Rails 3 overview
Rails 3 overview
Yehuda Katz
OAuth Echo の Rails Gem
OAuth Echo の Rails Gem
Toru Kawamura
セキュリティとコンプライアンスプログラムについて
セキュリティとコンプライアンスプログラムについて
Toshiboumi Ohta
More Related Content
What's hot
優しいWAFの作り方
優しいWAFの作り方
techmemo
How to develop modern web application framework
How to develop modern web application framework
techmemo
Silex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
With a Mighty Hammer
With a Mighty Hammer
Ben Scofield
Mojolicious
Mojolicious
Marcos Rebelo
Storytelling By Numbers
Storytelling By Numbers
Michael King
Complex Sites with Silex
Complex Sites with Silex
Chris Tankersley
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
Javier Eguiluz
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
Design how your objects talk through mocking
Design how your objects talk through mocking
Konstantin Kudryashov
Rails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
Get into the FLOW with Extbase
Get into the FLOW with Extbase
Jochen Rau
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
Samuel ROZE
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
Michelangelo van Dam
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
Ryan Weaver
Алексей Плеханов: Новинки Laravel 5
Алексей Плеханов: Новинки Laravel 5
Oleg Poludnenko
Rails 3 overview
Rails 3 overview
Yehuda Katz
What's hot
(20)
優しいWAFの作り方
優しいWAFの作り方
How to develop modern web application framework
How to develop modern web application framework
Silex Cheat Sheet
Silex Cheat Sheet
With a Mighty Hammer
With a Mighty Hammer
Mojolicious
Mojolicious
Storytelling By Numbers
Storytelling By Numbers
Complex Sites with Silex
Complex Sites with Silex
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Design how your objects talk through mocking
Design how your objects talk through mocking
Rails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Get into the FLOW with Extbase
Get into the FLOW with Extbase
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
Алексей Плеханов: Новинки Laravel 5
Алексей Плеханов: Новинки Laravel 5
Rails 3 overview
Rails 3 overview
Viewers also liked
OAuth Echo の Rails Gem
OAuth Echo の Rails Gem
Toru Kawamura
セキュリティとコンプライアンスプログラムについて
セキュリティとコンプライアンスプログラムについて
Toshiboumi Ohta
Hyman Charme 09 11 09 Final 1
Hyman Charme 09 11 09 Final 1
guest7f6f4c6
セキュそば 090314
セキュそば 090314
Toshiboumi Ohta
Girls Day Out Giving Project 2009
Girls Day Out Giving Project 2009
jwinzenried
FabricとRailsと私
FabricとRailsと私
Chikara Miyake
Plugin for CakePHP2.0
Plugin for CakePHP2.0
Takashi Nojima
Composerはじめました
Composerはじめました
Takashi Nojima
Viewers also liked
(8)
OAuth Echo の Rails Gem
OAuth Echo の Rails Gem
セキュリティとコンプライアンスプログラムについて
セキュリティとコンプライアンスプログラムについて
Hyman Charme 09 11 09 Final 1
Hyman Charme 09 11 09 Final 1
セキュそば 090314
セキュそば 090314
Girls Day Out Giving Project 2009
Girls Day Out Giving Project 2009
FabricとRailsと私
FabricとRailsと私
Plugin for CakePHP2.0
Plugin for CakePHP2.0
Composerはじめました
Composerはじめました
Similar to TwitterKitではじめる OAuthスピードクッキング
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
danwrong
An introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
Building TweetEngine
Building TweetEngine
ikailan
Api
Api
randyhoyt
Twitter4R OAuth
Twitter4R OAuth
Susan Potter
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Michelangelo van Dam
Let's read code: the python-requests library
Let's read code: the python-requests library
Susan Tan
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
Neil Crookes
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Hisateru Tanaka
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
Michelangelo van Dam
Lecture n
Lecture n
ganeshpatil1989
Language literacy
Language literacy
Sanjulika Rastogi
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
Michelangelo van Dam
Mining Georeferenced Data
Mining Georeferenced Data
Bruno Gonçalves
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHP
Fabien Potencier
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Michelangelo van Dam
Motion Django Meetup
Motion Django Meetup
Mike Malone
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
Srijan Technologies
Cakephpstudy5 hacks
Cakephpstudy5 hacks
Hiroki Shimizu
YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기
Jinho Jung
Similar to TwitterKitではじめる OAuthスピードクッキング
(20)
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
An introduction to Laravel Passport
An introduction to Laravel Passport
Building TweetEngine
Building TweetEngine
Api
Api
Twitter4R OAuth
Twitter4R OAuth
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Let's read code: the python-requests library
Let's read code: the python-requests library
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
Lecture n
Lecture n
Language literacy
Language literacy
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
Mining Georeferenced Data
Mining Georeferenced Data
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHP
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Motion Django Meetup
Motion Django Meetup
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
Cakephpstudy5 hacks
Cakephpstudy5 hacks
YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기
Recently uploaded
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Katpro Technologies
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Recently uploaded
(20)
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
TwitterKitではじめる OAuthスピードクッキング
1.
Jul 2010 CakePHP
2.
•
Twitter API • OAuth • TwitterKit • TwitterKit • TwitterKit
3.
About Me •
WEB Developer / PHP / CakePHP / HTML / CSS / jQuery / PostgreSQL / MySQL / iPhone / / / / / / / / no more • BLOG: http://php-tips.com/ • TWITTER: @nojimage
4.
Twitter API
5.
Twitter API •
http://api.twitter.com/ HTTP JSON XML ‣ ‣ ‣ ‣ etc... • • http://dev.twitter.com/
6.
OAuth •
Twitter API Basic OAuth ‣ Basic • ConsumerKey AccessToken ‣ ‣ Twitter AccessToken • dev.twitter.com
7.
OAuth •
Twitter ‣ ConsumerKey RequestToken Twitter ‣ Authorize URL ← • Twitter • Twitter ‣ URL (oauth_token, oauth_verifier) ‣ RequestToken AccessToken Twitter ‣ AccessToken ConsumerKey API
8.
TwitterKit
9.
TwitterKit •
TwitterAPI ‣ DataSource, Behavior, Component ‣ Twitter • ‣ PHP 5.2 upper (json_encode/json_decode) ‣ CakePHP 1.3 + ‣ jQuery 1.4.2 + http://github.com/elstc/twitter_kit
10.
TwitterKit •
Twitter API ‣ http://openlist.jp/ ‣ http://tsuketter.com/ ( ) • pear HTTP_OAuth ‣ pear Neil Crookess(@neilcrookes) HttpSocketOauth • OAuth
11.
12.
• •
13.
• •
14.
•
http://dev.twitter.com/apps/new ‣ ‣ callback localhost ‣ Read Write
15.
•
http://dev.twitter.com/apps/{app_id} • Consumer Key Consumer Secret • My Access Token AccessToken
16.
TwitterKit Install •
[git clone] cd app/plugins git clone http://github.com/elstc/twitter_kit.git ‣ git github • DB [cake schema] cake/console/cake schema create TwitterKit.TwitterKit ‣ Enter
17.
database.php •
ConsumerKey, ConsumerSecret, CallbackURL <?php class DATABASE_CONFIG { var $default = array( // DB ..... ); var $twitter = array( // twitter 'driver' => 'TwitterKit.TwitterSource', 'oauth_consumer_key' => '{YOUR_CONSUMER_KEY}', 'oauth_consumer_secret' => '{YOUR_CONSUMER_SECRET}', 'oauth_callback' => '/twitter_kit/oauth/callback', 'cache' => true, // app/tmp/cache/twitter/ ); }
18.
Model •
Behavior <?php class Tiwt extends AppModel { var $name = 'Tiwt'; var $useTable = false; // // TwitterTweetBehavior var $actsAs = array('TwitterKit.TwitterTweet'); }
19.
Controller •
Component, Helper <?php class TiwtsController extends AppController { var $name = 'Tiwts'; // var $components = array('TwitterKit.Twitter'); // TwitterFormHelper var $helpers = array('TwitterKit.TwitterForm'); }
20.
AuthComponent •
AppController::beforeFilter() <?php class AppController extends Controller { var $components = array('Session', 'Auth'); // ... public function beforeFilter() { $this->Auth->authorize = 'controller'; $this->Auth->userModel = 'TwitterKit.TwitterKitUser'; $this->Auth->loginAction = array( 'plugin' => 'twitter_kit', 'controller' => 'users', 'action' => 'login'); } // ...
21.
AuthComponent •
isAuthorized AccessToken <?php class AppController extends Controller { // ... public function isAuthorized() { // set OAuth ConnectionManager::getDatasource('twitter')->setToken( $this->Auth->user('oauth_token'), $this->Auth->user('oauth_token_secret') ); // ... return true; } // ...
22.
Action! •
TwitController::index() • HOME • Model fetch • TwitController::add() • POST • Model teewt •
23.
TiwtsController::index() function index() {
if ($this->Session->read('reflash')) { // $this->Twitter->refreshCache(); } $timelines = $this->Tiwt->fetch($this->params['named']); $this->set(compact('timelines')); }
24.
Tiwt::fetch() function fetch($options =
array()) { $params = array(); foreach (array('since_id', 'max_id', 'count', 'page') as $key) { if (!empty($options[$key])) { $params[$key] = $options[$key]; } } // $results = $this->getTwitterSource()->statuses_home_timeline($params); if (empty($results)) { return array(); } // return array_map(array($this, '_reverse'), $results); }
25.
TiwtsController::add() function add() {
$this->autoRender = false; if (!empty($this->data)) { if ( $this->Tiwt->teewt($this->data) ) { $this->Session->write('reflash', true); // $this->Session->setFlash($this->Tiwt->strrev(' ')); } else { $this->Session->setFlash($this->Tiwt->strrev(' ')); } } $this->redirect(array('action' => 'index')); }
26.
Tiwt::teewt() function teewt($data =
null) { if (empty($data)) { $data = $this->data; } // (tweet TwitterKit::TwitterTweet ) return $this->tweet($this->strrev($data[$this->alias]['text'])); }
27.
Tiwt::strrev(), Tiwt::_reverse() function _reverse($data)
{ if (empty($data)) { return array(); } $data['rev']['text'] = $this->strrev($data['text']); $data['rev']['user']['screen_name'] = $this->strrev( $data['user']['screen_name']); return $data; } function strrev($str){ preg_match_all('/./us', $str, $ar); return join('', array_reverse($ar[0])); }
28.
View •
layout/default.ctp • jQuery • tiwts/index.ctp • → TwitterFormHelper::tweet() •
29.
http://tiwt.php-tips.com/
30.
•
Twitter • TwitterKit github PULL
Editor's Notes
Download now