Question

I would like to tweet on behalf of a single Twitter account.

There is a lot of conflicting and outdated info on this.

Do I really need OAuth, or can I generate the token manually then save the token in my app to post to the account permanently?

Does this token expire?

Was it helpful?

Solution

According to the Twitter documentation you should use 3-legged OAuth (see "Want to read or post Twitter data on behalf of visitors to your website..." here). And if you read about 3-legged OAuth you will find that it uses the endpoint GET /oauth/authorize, for which the documentation states it uses OAuth 1.0 flow. And in this section of the FAQ it says the following:

The access tokens yielded to your through the OAuth process do not have an explicit expiration datetime attached to them. They will be valid for use when making requests on behalf of your users for as long as the user has granted your application access. A user can revoke access to your application at any time.

Please note that the strings representing access tokens are not static -- if a user revokes your application or otherwise transits from one permission level to another (such as from read-only to read-write), the strings will be altered.

So from this I would derive that yes, you can get the token manually and then use that as long as you do not revoke the app or change the permission level, but I would probably not recommend it. Maybe if you dont want to implement OAuth you could check out one of the .NET libraries available for the Twitter API and hope someone else has already done what you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top