chok / sfMelodyPlugin

Allow to communicate with many services(google, yahoo...) throw OAuth
MIT License
45 stars 21 forks source link

Using sfMelody to connect to Twitter as a single user #36

Closed sglessard closed 13 years ago

sglessard commented 13 years ago

Hello,

I was using curl to get tweets from a single user (some company) to print on some website. I recently installed sfMelody to use OAuth. I don't figure out how to use "Access token" and "Access token secret" in app.yml. I tried some lines, like :

twitter:
  key:  <string>
  secret: <string>

  user:
    screen_name: someuser
    oauth_token: <string>
    oauth_token_secret: <string>

or

  auth_parameters:
    oauth_token: <string>
    oauth_token_secret: <string>

Is there a way to use Twitter/sfMelody with a predefined user, without any access-url redirection?

sglessard commented 13 years ago

I've created the $storedTokenAccess by using $this->getUser()->connect('twitter'); then removed the code line.

$this->getUser()->signIn($someSfGuardUser);
$this->getUser()->addToken($storedTokenAccess);
var_dump($this->getUser()->getMelody('twitter')->getMe());
var_dump($this->getUser()->getMelody('twitter')->get('statuses/friends_timeline.json'));

Todo : test it.