Twitter Getting information about the authenticated user

Getting information about the authenticated user

In the Twitter API, the VerifyCredentials method both lets you verify and get information about the authenticated user. A call to this method can look like:

// Initialize a new OAuth client from the consumer key and secret
TwitterOAuthClient client = new TwitterOAuthClient {
    ConsumerKey = "your consumer/app key",
    ConsumerSecret = "your consumer/app secret",
    Token = "access token of the user",
    TokenSecret = "access token secret of the user"
};
            
// Initialize a new service instance from the OAuth client
TwitterService service = TwitterService.CreateFromOAuthClient(client);

// Make the call to the API
TwitterUserResponse response = service.Account.VerifyCredentials();

// Write out some information about the user
Console.WriteLine(response.Body.Name);
Console.WriteLine(response.Body.ScreenName);
Console.WriteLine(response.Body.StatusesCount);