I'm trying to use Twitter's API and OAuth to send status updates (new Tweets). I am using Shannon Whitley .NET code example http://www.voiceoftech.com/swhitley/?p=681 (as recommended on the Twitter API docs). I can read (GET) using OAuth just fine, however when I try to send a status update via http ://twitter.com/statuses/update.xml (using a POST), it returns a 401 with the following XML:

I swear I have set up my application to use read and write, the authorise page at Twitter (http ://twitter.com/oauth/authorize) even says "The application TweeVerbs.com (Development) by would like the ability to access and update your data on Twitter."

Yet it's still saying "Read-only application cannot POST". WTF!?

I have googled this error message until I was blue in the face. I found somewhere that said to add the querystring paremeter *oauth_access_type=write* to the redirect URL which goes to the Twitter authorise page which I have done, but it still gives me a 401.

If it helps, here is the data that is getting sent back and firth as per the OAuth workflow:

Authorise Screen Message:"The application TweeVerbs.com (Development) by would like the ability to access and update your data on Twitter. This application plans to use Twitter for logging you in in the future. Sign out if you want to connect to an account other than Sironfoot."

5 Answers
5

Dunno what the problem was, but I deleted my Application registration on Twitter (You have to register apps in Twitter to get OAuth keys etc.), and then recreated it. Now it works fine. Weird, probably a problem with Twitter screwing up.

I'm also using Tweetsharp (http://tweetsharp.com/), highly recommend it, it's got a nice fluent API. Note: switching over to Tweetsharp wasn't the fix, I had already switched over and had the same problem until I delete and recreated app registration on Twitter.

If you authorized your application to access your Twitter account when the application was set in "read only access" mode and you get the "Read-only application cannot POST" error after changing the application settings to be "read and write access" then you have to revoke access to the application on https://twitter.com/settings/connections and then reauthorize it. The "read only" access_token tends to be sticky until you revoke it.