OLD | NEW |
(Empty) | |
| 1 This directory contains an example app ("cloudauth") that demonstrates |
| 2 how to use an OAUTH2 flow within a web app to authorize App Engine access |
| 3 to Google Storage. |
| 4 |
| 5 To install and try the app, take the following steps: |
| 6 |
| 7 1. The current code assumes you are already familiar with Google |
| 8 App Engine, and and have the App Engine SDK installed. If that's not |
| 9 true, start at http://code.google.com/appengine/ |
| 10 |
| 11 In the remainder of these instructions, we assume |
| 12 you have gsutil unpacked in /usr/local/gsutil, Google |
| 13 App Engine installed at /usr/local/google_appengine, and |
| 14 http://pypi.python.org/pypi/google-api-python-client/1.0beta1 installed |
| 15 at /usr/local/google-api-python-client |
| 16 |
| 17 2. Copy the boto, cloudauth, and needed parts of the |
| 18 google-api-python-client code into the google_appengine directory: |
| 19 % cp -pr /usr/local/gsutil/cloudauth /usr/local/google_appengine |
| 20 % cp -pr /usr/local/gsutil/boto/boto /usr/local/google_appengine/cloudauth |
| 21 % cp -pr /usr/local/google-api-python-client-1.0beta1/{apiclient,httplib2,o
auth2client,gflags*.py} \ |
| 22 /usr/local/google_appengine/cloudauth |
| 23 |
| 24 3. Go to the Google APIs Console and create a project (see |
| 25 http://code.google.com/apis/console-help/). Then, click |
| 26 the "API Access" tab and then the "Create an OAuth2 client |
| 27 ID..." button. Enter a product name and click next, select "Web |
| 28 application", and then enter the host "http://localhost:8080", and |
| 29 click "Create client ID". Then click "Edit settings" and change the |
| 30 Authorized Redirect URIs to be http://localhost:8080/auth_return. |
| 31 (You'll need to update these values when you move from running |
| 32 this app locally to running on App Engine.) Then copy the Client |
| 33 ID and Client secret from this dialog into the corresponding values in |
| 34 /usr/local/google_appengine/cloudauth/cloudauth.py. Note that these |
| 35 values do not enable access until coupled with an OAUTH2 refresh token |
| 36 that will be generated by the OAUTH2 flow implemented in this web app - |
| 37 so it's safe to save the "secret key" value in your code. |
| 38 |
| 39 4. Try running it: |
| 40 % cd /usr/local/google_appengine |
| 41 % ./dev_appserver.py cloudauth |
| 42 and then open your browser to http://localhost:8080 |
| 43 |
| 44 If it works, you should see the object loaded. |
| 45 |
| 46 5. At this point you can upload your app to Google |
| 47 infrastructure, following the instructions at |
| 48 http://code.google.com/appengine/docs/python/gettingstarted/uploading.html |
| 49 |
| 50 6. You can see documentation about the OAUTH2 client library at |
| 51 http://code.google.com/p/google-api-python-client/wiki/OAuth2 |
OLD | NEW |