Wednesday, January 23, 2008

I am authentic!

Well, at least in the Google sense. I wrote a little Java program (that stretches out beyond the blog's viewing area, but you can still copy and paste in its entirety) that's able to authenticate me against Google:

public static void main(String[] args) {
GoogleService blogger = new GoogleService(BLOGGER , APP_NAME);
String authToken = null;
try {
authToken = blogger.getAuthToken(username, password, null, null, BLOGGER, APP_NAME);
} catch (AuthenticationException e) {
System.err.print("Could not log into account for " + username + ". Aborting.");
System.exit(-1);
}
System.out.print("Authentication succeeded, received token " + authToken);
}

I know, it isn't much. And had I actually read the full developer document, I would have been able to code this up in about five minutes. Instead, I managed to spend a half hour doing it. I'm special.

Oh, there was no snow on Highway 35. Only lots of fog. And the vista point they have at the corner of 92 and 35 is pretty unspectacular.