Requirements

To setup your application with Tweetinvi, you will need to have your Twitter Application credentials. If you do not have those credentials please visit the page Create your Twitter application.

 

Consumer Credentials

In your solution explorer open the App.Config of Examplinvi.

 

clip_image001

 

 

By default we provide the TweetinviApi application consumer credentials so that you can test directly.

 

  <appSettings>

    <add key="token_ConsumerKey" value="YOUR_APPLICATION_CONSUMER_KEY"/>

    <add key="token_ConsumerSecret" value="YOUR_APPLICATION_CONSUMER_SECRET"/>

 

    <add key="token_AccessToken" value="YOUR_TEST_ACCOUNT_ACCESS_TOKEN"/>

    <add key="token_AccessTokenSecret" value="YOUR_TEST_ACCOUNT_ACCESS_TOKEN_SECRET"/>

  </appSettings>

 

Whilst the Consumer credentials are required to identify your application, the Access Token are not required and can even be requested by Tweetinvi thanks to the TokenCreator class.

 

As a consequence populate the information of the token_ConsumerKey and the token_ConsumerSecret value fields by using your application consumer credentials.

 

Get a Token

Now to use your application, you will a user to login on Twitter REST API. To do so, you need the token_AccessToken and the token_AccessTokenSecret credentials of this user associated with your application.

 

You can get test credentials on the application page of Twitter. Otherwise you can create a Token by using the TokenCreator.

 

In the Examplinvi project, the Main method contains this code snippet :

 

// Initializing a Token with Twitter Credentials contained in the App.config

IToken token = new Token(

    ConfigurationManager.AppSettings["token_AccessToken"],

    ConfigurationManager.AppSettings["token_AccessTokenSecret"],

    ConfigurationManager.AppSettings["token_ConsumerKey"],

    ConfigurationManager.AppSettings["token_ConsumerSecret"]);

 

// Generate a Token with Access Token for the User

var t = GenerateToken(token);

 

if (t != null)

{

    token = t;

}

 

By using GenerateToken, the application will print your Token information.

 

clip_image003

 

You now have access to all the information you might need to access Twitter web services.

You might want to store this information so you can use them later on.

 

Please notice that by default, the token created from the App.config is overridden by the new generated Token.

 

Summary

We have seen that there is multiple ways to setup your Token. As I said, for test purposes set the Token information from the App.config. To allow new users using your application use the TokenCreator and generate a Token for your application.

Last edited Jul 25, 2013 at 12:03 AM by linvi, version 2