Tweeting Through console application

Nov 25, 2013 at 6:18 AM
Edited Nov 25, 2013 at 7:26 AM
Hi,

I am developing a console application to update status on twitter. I am using linqtotwitter library for this. I have already successfully implemented it for website. But when I use same credentials(4 keys), it says 'Unable to query twitter'.

I want to schedule this application, which fetches status from database and tweet. It is single user scenario.

My code in Program.cs file
    var auth = new SingleUserAuthorizer
    {
        Credentials = new SingleUserInMemoryCredentials
        {
            ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"],
            ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"],
            OAuthToken = ConfigurationManager.AppSettings["AccessToken"],
            AccessToken = ConfigurationManager.AppSettings["AccessTokenSecret"]
        }
    };
    auth.Authorize();
    var twitterCtx = new TwitterContext(auth);

    var tweet = twitterCtx.UpdateStatus(message);
    Console.Write(tweet.StatusID);
    Console.Read();
Need help guys.
Thanks
Coordinator
Nov 25, 2013 at 3:51 PM
Hi,

I need more information on the error you're receiving. Do you have the message, stack trace, and possible HTTP status code? Is there an InnerException?

You're using SingleUserInMemoryCredentials a little differently - e.g. it's more common to use TwitterAccessToken and TwitterAccessTokenSecret properties. Here's the docs on that:

https://linqtotwitter.codeplex.com/wikipage?title=Single%20User%20Authorization&referringTitle=Learning%20to%20use%20OAuth

Make sure your credentials aren't accidentally backwards.

@JoeMayo on Twitter
Nov 26, 2013 at 6:34 AM
Thanks for your reply.

I modified my credentials. It did work for me.