Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Can't publish first tweet

$
0
0
Hi, i've been looking at the examples and I can't seem to post a new tweet. Below is my code. Whenever I try to run it I can verify the app and get the access token information but I can't post a tweet (I just get 'False' written to the console).

I know the access token information is correct as it matches the access token code they give you on the API page but I just couldn't see why the tweet wouldn't post.
        static void Main(string[] args)
        {

            CredentialsCreator_WithCaptcha_StepByStep("CONSUMER KEY", "CONSUMER SECRET");
            Tweet_PublishTweet("test tweet");

            Console.ReadLine();
        }

        private static IOAuthCredentials CredentialsCreator_WithCaptcha_StepByStep(string consumerKey, string consumerSecret)
        {
            var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(consumerKey, consumerSecret);
            var url = CredentialsCreator.GetAuthorizationURL(applicationCredentials);
            Process.Start(url);
            Console.WriteLine("Go on : {0}", url);
            Console.WriteLine("Enter the captch : ");
            var captcha = Console.ReadLine();

            var newCredentials = CredentialsCreator.GetCredentialsFromVerifierCode(captcha, applicationCredentials);
            string accesstoken = newCredentials.AccessToken;
            string accesstokensecret = newCredentials.AccessTokenSecret;
            Console.WriteLine("Access Token = {0}", accesstoken);
            Console.WriteLine("Access Token Secret = {0}", newCredentials.AccessTokenSecret);

            return newCredentials;
        }

        private static void Tweet_PublishTweet(string text)
        {
            var newTweet = Tweet.CreateTweet(text);
            newTweet.Publish();

            Console.WriteLine(newTweet.IsTweetPublished);
        }
I also tried using the below example and didn't have any luck there:
var credentials = TwitterCredentials.CreateCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
{
        Tweet.PublishTweet("myTweet");
});
Thanks in advance for any help

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>