Login to the AppEngine web app from the Android client app

I am writing an Android application that I want to send requests to a Google App Engine application. To do this, the Android app must be authenticated by the user (to be able to use only its Google account). I'm not sure if I'm doing it right, but this is the only way I've found so far:

  • Send email, password, etc. at https://www.google.com/accounts/ClientLogin
  • Get an authorization token from the above address
  • Use the authorization token in the header of requests to the AppEngine application

But that doesn't work (users.get_current_user () still returns None). Is there a correct way to do this?

+2


source to share


1 answer


The approach you describe is almost correct. Instead, you need:

  • Send credentials to ClientLogin and return authorization token.
  • Send an authorization token to / _ah / login and return a cookie (and a 302 redirect).
  • Use the returned cookie for all subsequent requests.


This is the process appcfg uses - see appengine_rpc.py for an example of how to use it (and the module you can use if using Python) - specifically _ Authorize .

+1


source







All Articles