Dimitrios Politis
Dimitrios Politis

Reputation: 62

Trying to use Twitter from console application.Credentials somehow are stored the wrong way

I made a console application using Tweetinvi C# library. My project is almost complete if I solve this problem.

Every time I use Tweetinvi and set the credentials typing the keys directly into the code it works fine and publishes tweets so I know that command works. However I need to store the credentials in a file parse them to substring and clear them from spaces etc. Parsing is successful since I checked with console.writeline. When use variables to set the keys in tweetinvi authorization nothing happens which mean I 'm making a mistake when clearing my substrings. Consolle.Writelines shows nothing and credentials don't work. Any help?`

{                           
    AccessToken = AccessToken.Replace(@"\r\n", "");
    AccessToken = AccessToken.Trim();
    Console.WriteLine(AccessToken);
    AccessTokenSec = AccessTokenSec.Replace(@"\r\n", "");
    AccessTokenSec = AccessTokenSec.Trim();
    Console.WriteLine(AccessTokenSec);
    var creds = new TwitterCredentials("consumerkei", "consumerkeysecret",AccessToken.Trim(),AccessTokenSec.Trim());
    Auth.SetCredentials(creds);
    var firstTweet = Tweet.PublishTweet("Hello World! Again!");
}

Upvotes: 1

Views: 55

Answers (0)

Related Questions