How do I add authentication to a WFA?

Feb 24, 2015 at 9:32 PM
Hello trying to add authentication to a WFA, what are the requirements?

Do I need to have a browser window inside my application? or will it load inside a browser on the machine?

University Project so I could do with some guidance. Thanks
Feb 24, 2015 at 11:07 PM
Really stuck, the UI library seems to no longer exist in TweetInvi, I cant find any reference to that validation capture windows form example.
Feb 24, 2015 at 11:40 PM
Well I have worked out why, tokens no longer exist! My programming knowlege is limited. How would I go about logging in with IOAuth using a login form in my application, could you guys explain the concept?
Feb 25, 2015 at 1:04 AM

Sorry for the delay, I had to publish the latest version of the application.
When you say WFA, you mean Windows Form Application?

How would I go about logging in with IOAuth using a login form in my application, could you guys explain the concept?

Twitter does not give this option for quite some time now, the only way to use the Twitter API is to provide the OAuth credentials of your account.

Please have a look to the 2 following links:
Feb 25, 2015 at 11:13 AM
Yes I mean Windows Form Application.

Could I have a button on my form, and when pressed it executes the examples you have provided?

I am assuming that the user will have to be logged in to Twitter through their web browser of choice e.g Firefox or IE. - For the authentication to happen?

Feb 25, 2015 at 1:17 PM
Edited Feb 25, 2015 at 1:19 PM
Please try this example:
private static IOAuthCredentials CredentialsCreator_WithCaptcha_SingleStep(string consumerKey, string consumerSecret)
    Func<string, string> retrieveCaptcha = url =>
        // Change to display the information within your application

        Console.WriteLine("Go on : {0}", url);
        Console.WriteLine("Enter the captch : ");
        return Console.ReadLine();

    var newCredentials = CredentialsCreator.GetCredentialsFromCaptcha(retrieveCaptcha, consumerKey, consumerSecret);
    Console.WriteLine("Access Token = {0}", newCredentials.AccessToken);
    Console.WriteLine("Access Token Secret = {0}", newCredentials.AccessTokenSecret);

    return newCredentials;
Feb 25, 2015 at 2:50 PM
Edited Feb 27, 2015 at 6:35 PM
UPDATE: See official documentation for guidance on authentication with windows forms.
Feb 25, 2015 at 3:56 PM
Try Tweetinvi.CredentialsCreator, or add a using statement for Tweetinvi.
using Tweetinvi;
Also please use the code I sent instead of the one for Websites.

Feb 25, 2015 at 7:33 PM
I've tried your code, but i'm struggling to implementing it in to my project.

Do I paste all of the code in my project? Obvously I know I need to change the console writelines and read line.

But what else?

I've also added the name space, I have had plenty of success with carrying out many of the library's functions apart from this oAuth.

My project is a windows form with various buttons and text boxes carrying out tasks including pulling in tweets from twitter and then sending them to a CSV file (this all works without Oauth but its limited to 100 tweets because of no authentication)
Feb 25, 2015 at 7:34 PM
I'd be willing to pay for some advice if need be.
Feb 26, 2015 at 9:55 AM
Edited Feb 26, 2015 at 9:57 AM
No need to pay (but reviews and donations are always welcome) :p

Please send me your project, I will take a look at your issue.

Feb 26, 2015 at 6:31 PM
Edited Feb 27, 2015 at 6:35 PM
UPDATE: See official documentation for guidance on authentication with windows forms.
Feb 27, 2015 at 6:15 PM
As described in the documentation as per today find use the following code :
// This method shows you how to create Application credentials. 
// This type of credentials do not take a AccessKey or AccessSecret.
private ITemporaryCredentials CreateApplicationCredentials(string consumerKey, string consumerSecret)
    return CredentialsCreator.GenerateApplicationCredentials(consumerKey, consumerSecret);

// We need the user to go on the Twitter Website to authorize our application
private void GoToTwitterCaptchaPage(ITemporaryCredentials applicationCredentials)
    var url = CredentialsCreator.GetAuthorizationURL(applicationCredentials);
    Console.WriteLine("Please go on {0}, to accept the application and get the captcha.", url);

// On the Twitter website the user will get a captcha that he will need to enter in the application
private void GenerateCredentialsAndLogin(string captcha, ITemporaryCredentials applicationCredentials)
    var newCredentials = CredentialsCreator.GetCredentialsFromVerifierCode(captcha, applicationCredentials);
    // And now the user is logged in!
    var loggedUser = User.GetLoggedUser();
    Console.WriteLine("You are logged as {0}", loggedUser.ScreenName);
Marked as answer by linvi on 2/27/2015 at 3:34 PM