1

Could any body provide me steps of authenticated twitter api V1.1 (means provide me steps of code) for C#.NET.

4

3 Answers 3

4

I followed tweetsharp API "https://github.com/danielcrenna/tweetsharp" for posting tweet which support API V1.1.

Use library package manager and run command "PM> Install-Package TweetSharp " on package manger console .

    var _consumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"].ToString();
    var _consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"].ToString();
    var _accessToken = ConfigurationManager.AppSettings["twitterAccess"].ToString();
    var _accessTokenSecret = ConfigurationManager.AppSettings["twitterAccessSecret"].ToString();

    var service = new TwitterService(_consumerKey, _consumerSecret);
    service.AuthenticateWith(_accessToken, _accessTokenSecret);
    var status = "Collaborative short story of the day: Blah";
    var response = service.SendTweet(new SendTweetOptions() { Status = status }); 
1
  • Could not find the package TweetSharp. Is it still supported?
    – DivineOps
    Jul 11, 2015 at 20:35
2

I have personally never used the above solutions but I feel they are quite the same. Here is how to do with Tweetinvi C# API (website).

1st step is to create a Token for your Application on Twitter website. A Token will allow you to connect to Twitter and perform queries against the REST API 1.1.

With this ConsumerToken (application token) you can ask for a user of your application to create a Token by using the TokenCreator class.

TokenCreator tokenCreator = new TokenCreator("consumerKey", "consumerSecret");

If you already have the UserToken information you can simply create a Token by providing the information you want.

IToken token = new Token("userKey", "userSecret", "consumerKey", "consumerSecret");

When you have your Token you can perfom any operation you want.

Create a TweetExample :

IToken token = new Token("userKey", "userSecret", "consumerKey", "consumerSecret");
Tweet t = new Tweet("Hello world");
t.Publish(token);

Done!

0

Check out the Twitter library page: https://dev.twitter.com/docs/twitter-libraries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.