Since I happened to have this up, here's a bit of sample code to get an authentication cookie for an appspot app...
from google.appengine.api import urlfetch from urllib import urlencode email = request.POST['username'] passwd = request.POST['password'] serv_root = "http://myapp.appspot.com" target = 'http://myapp.appspot.com/null' app_name = "myapp-1.0" auth_uri = 'https://www.google.com/accounts/ClientLogin' authreq_data = urlencode({ "Email": email, "Passwd": passwd, "service": "ah", "source": app_name, "accountType": "HOSTED_OR_GOOGLE" }) result = urlfetch.fetch(auth_uri, authreq_data, method=urlfetch.POST, follow_redirects=False) auth_dict = dict(x.split("=") for x in result.content.split("\n") if x) auth_token = auth_dict["Auth"] serv_args = {} serv_args['continue'] = target serv_args['auth'] = auth_token serv_uri = "%s/_ah/login?%s" % (serv_root, urlencode(serv_args)) result2 = urlfetch.fetch(serv_uri, follow_redirects=False, method=urlfetch.GET) ### here's the cookie which will authenticate future requests cookie = result2.headers['set-cookie'].split(';')[0] # cookie[0] => "ACSID" # cookie[1] => "AAAAHFSDJHSDFHSDJFHSDJFHSJFSDfsdjfhsjdfhsjdfh..." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---