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.
After reading up on the Twitter API and OAuth, I want to see if I understand correctly the best way to maintain this functionality.
I've registered my application with dev.twitter.com and obtained the necessary Consumer Key and Consumer Secret.
The application may potentially need to tweet to more than one Twitter account as it is used by multiple users per installation.
If I understand things correctly I will need to do the following:
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.
Use the PIN number to obtain the user's
AccessToken
andAccessTokenSecret
.Store both of these tokens between sessions (launches) of the application.
My questions:
Should I encrypt either of these tokens when storing (in SQL)?
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.
Though it shouldn't affect any answers or advice, I am using the TweetSharp library.