I am trying to retrieve public tweets from a server-side application, using application-only authentication (no user context).
The following code works fine:
var service = new TwitterService("<consumer key>", "<consumer secret>");
service.AuthenticateWith("<access token>", "<access token secret>");
var options = new ListTweetsOnUserTimelineOptions { ScreenName = "billgates" };
foreach (var tweet in service.ListTweetsOnUserTimeline(options))
Console.WriteLine(tweet.Text);
However I gather from this diagram that it shouldn't be necessary to provide the access token/secret:
However when I remove the call to AuthenticateWith
, ListTweetsOnUserTimeline
returns null.
It is a limitation of the library, if not, how can I do it?
EDIT
Aas far as I can tell, this calls the GET statuses/user_timeline
method that should support application-only authentication, as per the documentation:
API methods that support this form of authentication will contain two rate limits in their documentation, one that is per user (for application-user authentication) and the other is per app (for this form of application-only authentication)
The GET statuses/user_timeline
method has these 2 limits shown in its documentation.
This means that the only requests you can make to a Twitter API must not require an authenticated user. With application-only authentication, you can perform actions such as: Pull user timelines.
For authentication purposes, each user has an Access Token (API key) and Access Token Secret (API secret) associated with it. Twitter app - A Twitter app can be created via the Twitter app dashboard page with an approved developer account.
Many of Twitter's enterprise APIs require the use of HTTP Basic Authentication.
You can select your App's authentication settings to be OAuth 1.0a or OAuth 2.0. You can also enable an App to access both OAuth 1.0a and OAuth 2.0. OAuth 2.0 can be used with the Twitter API v2 only. If you have selected OAuth 2.0 you will be able to see a Client ID in your App's Keys and Tokens section.
I think this in not a limitation of the library, but limitation of the Twitter API.
As far as I know, the ListTweetsOnUserTimeline() method uses statuses/user_timeline API call.
GET statuses/user_timeline
As you can see, this call requires authentication.
You can try to use the Streaming API for getting statuses. I can't help you here since I have only experience with user streams, not public.
Public streams
Besides, the TweetSharp has some problems with streams, I had to switch to Linq2Twitter library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With