Problem in Updating a Status

Nov 15, 2012 at 5:56 AM

Note: All the values used in the code are dummy

OK this is my main program looks like

            ITwitterAuthorizer auth = DoXAuth();

            using (var twitterCtx = new TwitterContext(auth))
            {
                OAuthDemos.Run(twitterCtx); // we run this to post a tweet
            }

App.Config is like this

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <!-- Fill in your consumer key and secret here to make the OAuth sample work. -->
    <!-- Twitter sign-up: https://dev.twitter.com/ -->
    <add key="twitterConsumerKey" value="5TIox09FWz0820hRC6LMO1"/>
    <add key="twitterConsumerSecret" value="m5SeR6DpQyAwnMtsc2V2GHfzQB3DKzQtjLYxfbxWM2"/>
    <add key="twitterOAuthToken" value="945534576-AIrLWU8JKVDqpfPFVmsmrMrGPwoMwlJu7fWY083o"/>
    <add key="twitterAccessToken" value="GBR4Pehm2Y1aKI3JgNWzHY1KaPMageiQ15SsalTQ"/>
    <add key="twitterUserName" value="username@gmail.com"/>
    <add key="twitterPassword" value="Password"/>
  </appSettings>

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

 

OK when i call the update function it is posting tweets to developers account even though i have not specified any user and password of developers accounts maybe its just posting on the basis of token and consumer keys.  I want to update the status to some other account. i have declared in app.config but not sure where to use in code so that tweets are post to this account

    <add key="twitterUserName" value="username@gmail.com"/>
    <add key="twitterPassword" value="Password"/>

Coordinator
Nov 16, 2012 at 3:18 AM

Hi,

The reason you aren't seeing any login action is because you've provided all 4 credentials. This works great if you have a server app that only operates on behalf of a single account. However, I understand that you need the app to work for each user.

To do that, remove twitterOAuthToken and twitterAccessToken, the user keys, from your config file.  All you need are twitterConsumerKey and twitterConsumerSecret which are your application keys. When the user keys aren't present, LINQ to Twitter will initiate the OAuth authentication process, which by default in a Console application will open the browser and navigate to Twitter's authentication page.

It sounds like you know what you want, but just in case you need more info I've written some documentation that might help:

Securing Your Applications

BTW, you'll probably want to edit out the credentials in your post because now anyone can use your credentials on Twitter. Better yet, you should visit your Twitter application page and re-key to get new credentials.

@JoeMayo