-
Notifications
You must be signed in to change notification settings - Fork 218
Basics
Please verify that the time of your machine is correctly setup (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.
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.
Because Twitter requires these credentials for each of the query executed, 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.
// Set up your credentials
TwitterCredentials.SetCredentials("Access_Token", "Access_Secret", "Consumer_Key", "Consumer_Secret");
When the credentials have been set, all operation performed with Tweetinvi will use these credentials.
Click Learn more about credentials
------------------- OLD --------------------
Tweetinvi has been designed to be simple and easy to use. Developers should be able to perform any operation from a global context or from the context of an object.
// GLOBAL CONTEXT : Using Tweetinvi Static Classes
var currentUser = User.GetLoggedUser();
// OBJECT CONTEXT : The current user requests to follow the user 'tweetinviapi'
currentUser.FollowUser("tweetinviapi");