Which version for Streaming API ?

Feb 25, 2014 at 12:07 PM
Hello again,

I've been trying to use the Streaming API but I get a little confused with the different versions.
So far, I was using v2.1.12 but I was not able to use the Single User authentication with it. So I moved to v3.0.1 and now I can authenticate as Single User but the streaming functions don't work anymore.

I've tried different things, using another OAuth method, separating modules so that the first one has a v2.1.12 reference and the other a v3.0.1 reference, but I get into new troubles with that.

So, is that a common issue or am I doing anything wrong ? Which version am I supposed to use to use the streaming API ?

Thank you in advance.
Feb 25, 2014 at 12:21 PM
Edited Feb 25, 2014 at 12:22 PM
Hum, sorry for double posting but it appears that I was using "AccessToken" and "AccessTokenSecret" while "OAuthToken" and "AccessToken" were expected.
I get a 401 error though, do they still match even if the names are different ?
Coordinator
Feb 25, 2014 at 4:14 PM
Hi,

The latest release of LINQ to Twitter is v3.0.2:

http://geekswithblogs.net/WinAZ/archive/2014/02/03/released-linq-to-twitter-v3.0.2.aspx

The downloadable source code has samples in the Linq2TwitterDemos_Console project.

@JoeMayo
Feb 28, 2014 at 4:05 PM
Edited Feb 28, 2014 at 4:06 PM
Hi,

Sorry to bother you again but I still get the 401 error, and I can't find out why.
I've tried with SingleUser, ApplicationOnly, v2, v3, but I don't think it comes from my code.
I've generated new tokens, created new applications, checked and re-checked my access tokens, I always get messages such as : "Invalid or expired tokens", "Bad authentication data" ... I really don't understand. Even my old code which used to work doesn't work anymore.

                    _auth = new ApplicationOnlyAuthorizer()
                    {
                        CredentialStore = new SingleUserInMemoryCredentialStore()
                        {
                            ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
                            ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
                            OAuthToken = ConfigurationManager.AppSettings["twitterOAuthToken"],
                            AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"]
                        }
                    };

                    if (_auth != null)
                    {
                        try
                        {
                            _twitterCtx = new TwitterContext(_auth);
                        }
                        catch (Exception err)
                        {
                            Console.WriteLine(err);
                        }

                        try
                        {
                            var helpResult =
                                (from help in _twitterCtx.Help
                                 where help.Type == HelpType.RateLimits
                                 select help)
                                    .SingleOrDefault();


                            foreach (var limit in from category in helpResult.RateLimits where category.Key.Equals("search") from limit in category.Value select limit)
                            {
                                Console.WriteLine(limit.Remaining);
                            }
                        }
                        catch (Exception err)
                        {
                            Console.WriteLine( err);
                        }
                   }
Thanks for your time.
Coordinator
Feb 28, 2014 at 4:44 PM
The downloadable source code has a couple projects you might want to review and compare to what you're doing: LinqToTwitterDemo is for v2.12 and Linq2TwitterDemos_Console is for v3.0. If you're receiving 401 errors, here's the FAQ, which has many reasons why this happens and what you can do about it: https://linqtotwitter.codeplex.com/wikipage?title=LINQ%20to%20Twitter%20FAQ&referringTitle=Documentation.

First, look at your ApplicationOnlyAuthorizer and compare it to the sample code because it doesn't look quite right.
Feb 28, 2014 at 5:04 PM
Edited Feb 28, 2014 at 5:09 PM
Woops, I just missed a ctrl-z before copying/pasting : it is not ApplicationAuthorizerOnly but SingleUser Authorizer !
So the problem remains ... I'll check again the samples but ...

Edit : I checked and my auth function is the same as in the samples.