views:

244

answers:

3

I have been thinking of maybe writing a little tool that logs into SO and updates my profile info with some topical/current info on a regular basis (eg. my latest blog post or questions I need help on, etc...)

To get this to work I will need to somehow log on to SO from a console app.

Is there a .Net library that streamlines logging on to an openid website using raw http requests?

A: 

Here's the most likely place to find it:

http://wiki.openid.net/Libraries

There is one called DotNetOpenId, written in C#, on the list, so it looks promising ;-) but I know nothing about .NET so I couldn't tell you if it will work for you specifically.

Also, a possibly related question.

David Zaslavsky
I think that library is geared towards websites authentication, will have a look at it
Sam Saffron
+3  A: 

Nope. Or at least, you can't do it in the general case. Because the part where you present your credentials to your OpenID provider could be anything, right? Maybe the provider authenticates through a token or a phone call or voice auth or whatever, that's outside the OpenID spec.

So you've got two options. One is to get SO to provide a more accessible API for editing your profile, using some mechanism better suited to automated calls (e.g. OAuth).

The other is, if you're writing this code for your personal use, you can control which OpenID provider you're using and choose one that's scriptable. In the extreme case, you could run your own provider an then put whatever security you wanted between your script and your provider. Or you could just try writing a script with something like Mechanize that logged in to your current provider. (Just be sure you have it be well-behaved with respect to hidden form elements and cookies. Good OpenID providers can be very picky about that stuff, to protect your account from cross-site request forgery attacks.)

keturn
+1 this is really helpful
Sam Saffron
+1  A: 

As has been said, you can't generally script logging into an OpenID site, but if the site you want to log into for your console app supports (or can be made to support) OAuth, then you absolutely can get what you want done.

See this question which addresses this, and the accepted answer, which explains all the details: http://stackoverflow.com/questions/544388/openid-authentication-and-api-access/555474#555474

Andrew Arnott