Beginner Question – Stream Won’t Start

Feb 26, 2015 at 8:22 PM
Hello,
I just started working with this a few days ago. I’m trying to get something basic up running as a POC. I cannot get the stream to start. Can someone help and tell me what I’m doing wrong?

Thanks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tweetinvi;
using Tweetinvi.Streams;

namespace TweetinviPOC
{
    class Program
    {
        static void Main(string[] args)
        {
            string Consumer = "<removed>";

            string ConsumerSecret = "<removed>";

            string AccessToken = "<removed>";

            string AccessTokenSecret = "<removed>";

            TwitterCredentials.SetCredentials(AccessToken, AccessTokenSecret, Consumer, ConsumerSecret);

            try
            {
                TwitterStream();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.ReadLine();
        }

        private static void TwitterStream()
        {
            var stream = Tweetinvi.Stream.CreateSampleStream();
            stream.TweetReceived += (sender, args) =>
            {
                Console.WriteLine(args.Tweet.Text);
            };
            stream.StartStream();
            Console.WriteLine("Stream State: " + stream.StreamState.ToString());
        }
    }
}

Coordinator
Feb 26, 2015 at 10:29 PM
Hello this code is supposed to work.
Can you please use the ExceptionHandler and let me know if there is anything in it?

Linvi
Feb 26, 2015 at 10:34 PM
Edited Feb 26, 2015 at 10:41 PM
What I said before was not correct. I'm getting a 401 and here are the values.
‡ Tweetinvi.Core.Exceptions.ITwitterException.TwitterDescription.get returned "Unauthorized - Authentication credentials were missing or incorrect." string
    exceptionDetails    "Invalid or expired token." string
I have verified that my clock is correct maybe my token is bad?

Thanks again for your help.
Marked as answer by MrVolition on 2/26/2015 at 3:56 PM
Feb 26, 2015 at 10:56 PM
It was my tokens <facepalm> working now. Love the library!!
Coordinator
Feb 26, 2015 at 11:12 PM
Good, I have not done a lot, but I am happy your fixed this :)

Enjoy Tweetinvi :p