2

I'm trying to use simple single-user in-memory credentials to connect to my twitter app and do a simple timeline search. I have my consumer secret and key but On the instructions page it also lists a need for an oauth token and access token. What are these? Where do I get them.

ghord
  • 13,260
  • 6
  • 44
  • 69
George Mauer
  • 117,483
  • 131
  • 382
  • 612
  • Weird.From [docs](http://bit.ly/13J34Wx): "Managing Keys After registering your application, you can obtain your OAuth keys. Y There are two keys you need for all OAuth scenarios, ConsumerKey and ConsumerSecret. You'll find the keys by visiting the Twitter Developer site, selecting My apps, and clicking the title of your application. You will put these keys in the appSettings section of app.config, web.config, or elsewhere depending on what type of application you're building. You could even create your own custom key store, but the goal is to make them available to your application. (...)" – Alfredo Cavalcanti Jul 14 '13 at 18:21
  • Yes - that is exactly the confusing part – George Mauer Jul 14 '13 at 18:29

2 Answers2

2

Please read https://dev.twitter.com/docs/auth/obtaining-access-tokens

and particularly https://dev.twitter.com/docs/auth/tokens-devtwittercom

1

I've updated that page. Here's the recommended way to use SingleUserAuthorizer:

        var auth = new SingleUserAuthorizer
        {
            Credentials = new SingleUserInMemoryCredentials
            {
                ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
                ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
                TwitterAccessToken = ConfigurationManager.AppSettings["twitterAccessToken"],
                TwitterAccessTokenSecret = ConfigurationManager.AppSettings["twitterAccessTokenSecret"]
            }
        };

Here, you can see that the code populates TwitterAccessToken and TwitterAccessTokenSecret from values in your config file. Visit your app at https://dev.twitter.com to find these keys. Then populate the appSettings (twitterAccessToken and twitterAccessTokenSecret) in your config file with the AccessToken and AccessTokenSecret from your Twitter app page.

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60