?

Log in

No account? Create an account
Cookie generaton and handling - LiveJournal Client Discussions — LiveJournal [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Cookie generaton and handling [Jul. 24th, 2004|02:14 pm]
LiveJournal Client Discussions

lj_clients

[talisker]
[mood |confusedconfused]

I'm playing with the source code of LJ.NET these days. I noticed that every communication with the LJ server uses cleartext auth, which isn't the best thing in the world. I'd like to switch over to cookie-based auth, but I'm having a problem.

From what I read of the API spec, any successful login should set an ljsession cookie - which defaults to a session cookie which is erased once the browser (or client) is closed. In C#, I can keep that as a static var that I can use for all the communication requests, no problem. The only problem is that I'm never getting that cookie. My login works fine, but the only cookie I receive after a successful login is ljuniq.

Am I doing something wrong? If anybody can help me on this one, I'd be mighty thankful.
linkReply

Comments:
[User Picture]From: vanbeast
2004-07-24 01:11 pm (UTC)
That's pretty damn close to what I did:

public static string Md5Hex( string input ) {
	MD5 hasher = new MD5CryptoServiceProvider();
	StringBuilder output = new StringBuilder( 32 );
	byte[] hashArray, inputArray;

	inputArray = Encoding.ASCII.GetBytes( input );
	hashArray = hasher.ComputeHash( inputArray );

	for (int i = 0; i < hashArray.Length; i++) {
		output.Append( String.Format( "{0:x2}", hashArray[i] ) );
	}

	return output.ToString();
}
(Reply) (Parent) (Thread)
[User Picture]From: vanbeast
2004-07-24 01:13 pm (UTC)
wow, why the hell didn't I do foreach?
(Reply) (Parent) (Thread)