Would isAuthenticated just check if the token/secret are set?  I had
assumed (perhaps incorrectly) that the object would be instantiated at
a point where you have the required credentials.  Checking to see if
you have already set the token/secret on an object would be a trivial
addition, but do you have a use case of when/why you'd need to do
that?

On Jun 3, 2:57 pm, Tim <[email protected]> wrote:
> Hello,
>
> (note: this question might actually be more a general programming
> question rather than specific to Twitter)
> I have been looking at a few PHP libraries to use OAuth with Twitter
> (thanks to Abraham and Jason amongst others) and noticed that most (if
> not all) of them have a constructor more or less like that:
> function __construct($consumer_key, $consumer_secret, $oauth_token =
> NULL, $oauth_token_secret = NULL)
> called with 2 or 4 arguments depending on where in the OAuth process
> we are. (access token already known or not)
>
> That usually means that the status of the OAuth process is to be
> managed in the controllers when creating the object.
> If you take the example from Abraham's 
> code:http://github.com/abraham/twitteroauth/blob/6b28e9e689d44a569576f7267...
> there's a lot of session variables management (granted, this code is
> provided as an example and advertised as "not for production"...)
>
> Basically, I feel that I'd rather do something like:
>
> $twitter = new TwitterOAuth();
> $twitter->getPublicTimeline();
> if ($twitter->isAuthenticated()) { $twitter->getFriendsTimeline();}
> etc.
>
> with the logic of if the access token is known being handled by the
> class itself.
>
> Since all the libraries I have seen didn't go this way (and were
> written by people who most probably know what they're doing a lot more
> than I do), I am wondering if I make any sense.
>
> Thanks for your help,
>
> Tim

Reply via email to