[Mono-list] TweetSharp Failing

Abe Gillespie abe.gillespie at gmail.com
Wed Mar 3 06:27:09 EST 2010


Hello again.

This is looking like a Mono bug to me.  If I edit TweetSharp's source
code to manually set the network credentials like this (at Ln 146,
BasicAuthWebQuery.cs):

var creds = new NetworkCredential(_username, _password);
var credCache = new CredentialCache();
var host = request.RequestUri.Scheme + Uri.SchemeDelimiter +
request.RequestUri.Host;
credCache.Add(new Uri(host), "Basic", creds);
request.Credentials = credCache;

then it will work.

TweetSharp relies on HttpWebRequest.  I've had a look through Mono's
System.Net/HttpWebRequest.cs source and it appears to me that it drops
the "Authorization" header.  This header is what TweetSharp uses to
send along authorization to api.twitter.com and works with Microsoft
.Net.

Please let me know if this is a bug and I'll file a report with a test
case using TweetSharp.

Thanks.
-Abe

On Wed, Feb 17, 2010 at 3:02 PM, Abe Gillespie <abe.gillespie at gmail.com> wrote:
> Hi,
>
> I'm doing something like this:
>
> var result = FluentTwitter
>                .CreateRequest()
>                .AuthenticateAs("sender", "password")
>                .DirectMessages()
>                .Send("receiver", "tweet tweet")
>                .AsJson()
>                .Request();
>
> On Windows this succeeds.  On Mono (Mac & Linux) I'm getting an
> exception with "401 Unauthorized" in the description.  Now I've used
> certmgr to install the certs at https://api.twitter.com and
> https://www.twitter.com for both the local user store and the machine
> store.  But I'm still getting the error.
>
> This certainly might be a TweetSharp question, but using the
> TweetSharp source I've traced the failure down to a single WebRequest
> call.
>
> Any ideas on this?
>
> Thanks.
> -Abe
>


More information about the Mono-list mailing list