401 Unauthorized Access

Feb 21, 2014 at 10:59 PM
I keep getting the error when trying to
run your code sample bellow. The credentials works fine when executing Curl request from
from tvitter/apps.
What could be wrong? Please help

static void Main()
    {
        var credentials = TwitterCredentials.CreateCredentials(
            ConfigurationManager.AppSettings["token_AccessToken"],
            ConfigurationManager.AppSettings["token_AccessTokenSecret"],
            ConfigurationManager.AppSettings["token_ConsumerKey"],
            ConfigurationManager.AppSettings["token_ConsumerSecret"]);

       var tweet = Tweet.CreateTweet("Xcent");
       tweet.Publish();
Coordinator
Feb 21, 2014 at 11:27 PM
Hi there,

You need to set the TwitterCredentials.Credentials value like that :
TwitterCredentials.Credentials = TwitterCredentials.CreateCredentials(
            ConfigurationManager.AppSettings["token_AccessToken"],
            ConfigurationManager.AppSettings["token_AccessTokenSecret"],
            ConfigurationManager.AppSettings["token_ConsumerKey"],
            ConfigurationManager.AppSettings["token_ConsumerSecret"]);
Linvi
Marked as answer by linvi on 3/15/2014 at 7:28 PM