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

New Post: Authentication with Embedded Credentials

$
0
0
Most certainly. Check out this simple example which does not work for me:
using System;
using Tweetinvi;
using Tweetinvi.Core.Interfaces.WebLogic;

namespace MyApp
{
    class Program
    {
        private static string AccessToken = "removed for security";
        private static string AccessTokenSecret = "removed for security";
        private static string ConsumerKey = "removed for security";
        private static string ConsumerSecret = "removed for security";

        static void Main(string[] args)
        {
            try
            {
                TwitterCredentials.SetCredentials(AccessToken, AccessTokenSecret, ConsumerKey, ConsumerSecret);
                
                var tweet = Tweet.PublishTweet("Test.");

                if (tweet == null)
                {
                    Console.WriteLine("Error tweeting:");
                    Console.WriteLine(ExceptionHandler.GetLastException().TwitterDescription);
                }
                else
                {
                    Console.WriteLine("Tweeted.");
                    Console.WriteLine(tweet.Text);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadKey();
        }
    }
}
This results in the output:
Error tweeting:
Unauthorized - Authentication credentials were missing or incorrect.

Viewing all articles
Browse latest Browse all 4126

Trending Articles