In this page, we will discuss of the fundamentals concepts that you need to understand before using Tweetinvi.
Before you start - IMPORTANT
Even before you start writing your first line of code, you need to verify that the time of your machine is correctly configured (both the time and the region).
Twitter verifies the DateTime issued when performing a request. If the DateTime is not the same as their servers, all WebRequests to the API will result in a 401 status code (UnAuthorized). When a 401 exception is received, Tweetinvi will either throw the Exception
or return null
to all your operations.
Let's get it started!
Configure your credentials
Now that we have properly configured our environment we can start using Twitter.
Twitter execute queries against credentials that are stored as OAuth Tokens. These tokens allow Twitter to identify the Application that want to execute an operation on behalf of a specific User.
Therefore the first thing we need to do is to set the credentials. The credentials contains 2 keys for the User also called Access Token, and 2 keys for the Application also called Consumer Token.
Learn more about credentials
// Set up your credentials
TwitterCredentials.SetCredentials("Access_Token", "Access_Secret", "Consumer_Key", "Consumer_Secret");