I am writing an Android application that speaks on a remote server, and I want to allow application users to register on the server using the google credentials that are on their phone, that is, not requiring the user to enter their Google password anywhere in my application. For example, if a user (Android) phone was configured using " someguy@gmail.com ", and then they install and launch my application, my application will present them with a dialog saying "Do you want to log in as someguy @ gmail.com?", and by clicking OK, they set up an identifier on my server that knows that its email address is someguy@gmail.com , which is certified by Google itself.
I found widespread and varied partial recipes on how to do this, including my own oauth2 documentation, but I didnโt guess how this all worked.
I have an Android code that uses AccountManager to find out which Google accounts are on this phone. I invite the user to specify which google account they would like to use to log in, and then I get an authorization token.
In the past, I rotate my wheels pretty hard. The recipes I looked at seem to require me to http get this form:
http://<myWebServer>.com/_ah/login?continue=<someUrlIChoose>&auth=<authToken>
... which (a) is unsatisfied in the sense that it is specific to appengine, and I want freedom to do this at either end of my choice and (b) even experiment with appengine, the application instance I "I'm configured, it seems it is not signaled at all, that is, the logs now show requests to it (I was hoping that someUrlIChoose url would be called by something) ... therefore, there is no way to be aware of the reality of the token.
Specific issues include:
- What should I do with the auth token ... I send it to my server and somehow my server contacts Google to check the expiration of the token for the specified account? Or is there some kind of backchannel of the message that should already be (at this stage of the process) that has arisen from google servers to tell my server that this token is valid (and if so, how to set it)? Or something else?
- Am I entitled to assume that this process should run in the context of either end (and not just appengine)?
- Is oauth2 what I should use (unlike oauth1 or something else)? Everything I read seems to imply that Google support for oauth2 is "experimental" ... but I have not stated that the statements are current or old; and even if current, google has a history of keeping various products in a constant non-confidential form (like eternal beta), so I donโt know what to do with it.
- Anything else that is relevant ...
user1390182
source share