When you register your app with Twitter, make sure you create create a placeholder callback in your app settings, or you will be locked to OOB auth. The callback can be anything, it's simply a placeholder.
- LinkedIn to Plugin/Twitter
- HttpSocketOauth plugin (ProLoser fork) to Plugin/HttpSocketOauth
- Apis plugin to Plugin/Apis
var $twitter = array(
'datasource' => 'Twitter.Twitter',
'login' => '<twitter api key>',
'password' => '<twitter api secret>',
);
MyController extends AppController {
var $components = array(
'Apis.Oauth' => 'twitter',
);
function connect() {
$this->Oauth->connect();
}
function twitter_callback() {
$this->Oauth->callback();
}
}
Check the config file for a list of available 'sections' and the parameters they take
Class MyModel extends AppModel {
public function afterSave($created) {
if ($created) {
// Auto Tweet
$this->setDataSource('twitter');
$data = array(
'section' => 'tweets',
'status' => $this->data['Bookmark']['name'] . ' ' . $this->data['Bookmark']['url']
);
$this->create();
$this->save($data);
$this->setDataSource('default');
}
}
}