title: Client app using Twitter and OAuth: Is my method correct?
body: <p>I have an application that I've developed in .NET 4.0/C#. It's designed to be used by customers that want to watch hardware sensors and alert them of specific values. One option for notification is by "tweeting" to a Twitter account of their choice. Before Twitter changed to OAuth, users entered their account name and password and this was enough to send Tweets on their behalf.</p>
  
  <p>After reading up on the Twitter API and OAuth, I want to see if I understand correctly the best way to maintain this functionality.</p>
  
  <p>I've registered my application with <a href="http://dev.twitter.com" rel="nofollow">dev.twitter.com</a> and obtained the necessary Consumer Key and Consumer Secret.</p>
  
  <p>The application may potentially need to tweet to more than one Twitter account as it is used by multiple users per installation.</p>
  
  <p>If I understand things correctly I will need to do the following:</p>
  
  <ol>
  <li><p>Provide some sort of "Request Authorization" button on a per-user basis, which launches a Twitter authentication web site. There, the user logs in and is then provided with a PIN number.</p></li>
  <li><p>Use the PIN number to obtain the user's <code>AccessToken</code> and <code>AccessTokenSecret</code>.</p></li>
  <li><p>Store both of these tokens between sessions (launches) of the application.</p></li>
  </ol>
  
  <p>My questions:</p>
  
  <ol>
  <li><p>Should I encrypt either of these tokens when storing (in SQL)?</p></li>
  <li><p>Is it ever necessary to re-authorize? The program is intended to be setup just once, then run unattended. Re-authorizing accounts will be a deal-breaker.</p></li>
  </ol>
  
  <p><em>Though it shouldn't affect any answers or advice, I am using the <a href="http://tweetsharp.codeplex.com/" rel="nofollow">TweetSharp</a> library.</em></p>