"Parameter name: You must provide a consumerKey."

Nov 27, 2013 at 4:28 AM
I am a beginner programmer trying to figure out out to perform a search for Tweets. I am getting the error: "consumerKey\r\nParameter name: You must provide a consumerKey.".

My code is: (note: I added the appropriate token/key values where needed)
           var auth = new SingleUserAuthorizer
                Credentials = new SingleUserInMemoryCredentials
                    ConsumerKey = ConfigurationManager.AppSettings["-"],
                    ConsumerSecret = ConfigurationManager.AppSettings["-"],
                    OAuthToken = ConfigurationManager.AppSettings["-"],
                    AccessToken = ConfigurationManager.AppSettings["-"]

            using (var twitterCtx = new TwitterContext(auth))

                var srch =
                    (from search in twitterCtx.Search
                     where search.Type == SearchType.Search &&
                           search.Query == "LINQ to Twitter" &&
                           search.Count == 7
                     select search)

                Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query);
                srch.Statuses.ForEach(entry =>
                        "ID: {0, -15}, Source: {1}\nContent: {2}\n",
                        entry.StatusID, entry.Source, entry.Text));
any suggestions?
Nov 27, 2013 at 7:33 AM

Look at what you're assigning to ConsumerKey. It looks like the appSettings name, "-", isn't valid:


This has to match an entry in your *.config file in the <appSettings> section. Check out the downloadable source code and observe how appSettings is set up. You assign your tokens to the values there and that lets ConfigurationManager.AppSettings["twitterConsumerKey"] read it, assuming you have a key set to "twitterConsumerKey" with the value set to your consumer key that you got from Twitter.

Here are the docs for a little more help:


@JoeMayo on Twitter