401 http://twitter.com/statuses/update.json


#1

I keep receiving 401 when calling the following code.

private string _twitterJsonUrl = "http://twitter.com/statuses/update.json";

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(TwitterJsonUrl);
System.Net.ServicePointManager.Expect100Continue = false;

string post = string.Empty;
using (TextWriter writer = new StringWriter())
{
writer.Write(“status={0}”, Uri.EscapeUriString(message));
post = writer.ToString();
}

request.Timeout = 500000;
request.Method = “POST”;
request.ContentType = “application/x-www-form-urlencoded”;
request.UserAgent = “My Application Name”;
request.Credentials = new NetworkCredential(TwitterUser, TwitterPass);

using (Stream requestStream = request.GetRequestStream())
{
using (StreamWriter writer = new StreamWriter(requestStream))
{
writer.Write(post);
}


#2

Few quick things:

First and foremost, you’re trying to use basic auth (username and password) which hasn’t been supported by the Twitter API in quite some time. You’ll need to use [node:3240] instead.

Also: Your API URL for issuing a status update is out of date. The API is versioned and has its own subdomain these days. See [node:99].


#3

Are there any examples of using OAuth and sending a tweet via C# that you can point me towards?
Also will I be able to take users username/password and tweet for them via my application?

Thanks


#4

Are there any examples of using OAuth and sending a tweet via C# that you can point me towards?
Also will I be able to take users username/password and tweet for them via my application?

Thanks