Authentication for Installed Applications - Obtain ACSID Cookie?

217 views
Skip to first unread message

Mike Chirico

unread,
Jun 8, 2008, 10:48:57 AM6/8/08
to Google App Engine


Is there a way to generate the ACSID cookie from the curl program?

For example, the following link demonstrates how cURL can be used to
generate the Auth
token and login to the Picasa web service.

http://code.google.com/support/bin/answer.py?answer=78451&topic=12359

However, the Auth token does not seem to work for the Google App
Engine. Instead, it
appears Google App Engine needs a valid ACSID cookie to get the user
email from
users.get_current_user()

Are there instructions on generating an ACSID cookie for an installed
application?

Or, is there a way to leverage the Auth token, from the python import
users module
in the Google App Engine, to verify a valid email address?

Regards,

Mike Chirico




Marzia Niccolai

unread,
Jun 9, 2008, 1:10:39 PM6/9/08
to google-a...@googlegroups.com
Hi,
 To use any of the Google Data APIs with App Engine using AuthSub, please see the gdata-python-client library, which has support for Picasa Web Albums:
http://code.google.com/p/gdata-python-client/

Also, read our article on the subject!
http://code.google.com/appengine/articles/gdata.html

-Marzia

Mike Chirico

unread,
Jun 9, 2008, 9:48:00 PM6/9/08
to Google App Engine
Excellent! The documentation was in the Python code.

Here's how it can be done with curl:

Step 1:

You need the auth token. The following program generates this token
for dev.mc...@gmail.com

#!/bin/bash
curl https://www.google.com/accounts/ClientLogin \
-d Email=dev.mc...@gmail.com -d Passwd=PaSSword \
-d accountType=GOOGLE \
-d source=Google-cURL-Example \
-d service=lh2 -k


This will return 3 tokens. Only the Auth token is needed for step 2

SID=DQ ....
LSID=DQAAH
Auth=DA...<lots of other characters>


Step 2:

Get the ACSID. This has to be done at the Google App Engine site,
which is normally done with a browser. Note that that complete auth
token above is used at the end of the string.

curl -c cookiefile "http://your.app.enginesite/_ah/login?
continue=http://your.app.enginesite/&auth=DQA..."

The above command writes this cookie to the file cookiefile.

I'll post a complete C example, which might be useful anyone doing
development with an embedded device, or even an application running on
a PC that may need to login to GAE. Agreed. Tools have already been
written for Python; however, I can see cases where Python may not be
installed.

Regards,

Mike Chirico
Reply all
Reply to author
Forward
0 new messages