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

New Post: Cannot send a Tweet

$
0
0
OK, cracked it, there is another Token being returned from the GetCredentialsFromVerifierCode, so I was using the new Secret with the old Token.

Final code below, phew
            // Consumer Key and Secret are specific to your application, you can get these on apps.twitter.com
            var applicationCredentials =
                CredentialsCreator.GenerateApplicationCredentials(oauth_consumer_key, oauth_consumer_secret);

            var url = CredentialsCreator.GetAuthorizationURL(applicationCredentials);

            // Open the URL to authenticate yourself on Twitter
            Process.Start(url);
            Console.WriteLine("Please enter the captcha : ");
            var captcha = Console.ReadLine();

            // Here are the new credentials!
            var result = CredentialsCreator.GetCredentialsFromVerifierCode(captcha, applicationCredentials);


            Console.WriteLine(result.AccessTokenSecret);


            TwitterCredentials
                .SetCredentials
                (
                    result.AccessToken,
                    result.AccessTokenSecret, 
                    oauth_consumer_key, 
                    oauth_consumer_secret
                );

            var tweet = 
                Tweetinvi
                .Tweet
                .PublishTweet("test status " + Guid.NewGuid());

Viewing all articles
Browse latest Browse all 4126

Trending Articles



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