How can I Authorize an Application automatically?



I have a task at work: we’re building a site using Classic ASP (yeah, I know…) and whenever a new blog post is posted, there should be an automatic tweet about that blog post in site’s tweet account. Posting works fine, but since it needs to be automatic, I must avoid manual logging-in, authentication, etc…
So my question is: how can I Authorize an application automatically? Because I need to avoid/automatizate the step… Any ideas? Thanx in advance ;]


Think of the act of authenticating as something you only need to do once. You persist the values that you get as a result of that process – a oauth_token and oauth_token that equal the user’s access token. You then use that to post tweets via the API.


Well, it would be perfect if the first authentication was enough, but if I want to post automatically I need to be logged-in, otherwise I get this error:
error: "Could not authenticate with OAuth."
How can I make it automatized so that the user wouldn’t need to sign-in in order to post? I’ve been stuck on this for over a week now ;/


You need to use Twitter API’s “Application-only” authentication mode.

Feel free to use my ASPTwitter class as a starting point. The code already does OAuth authentication and gets tweets, and works with Twitter API 1.1. Just copy the token method and change the API URL and post data: