title: Android SSO (Single sign-on) for app
body: <p>Is there any free single-signon mechanism for Android that gracefully works with non-webapps? Say, something along the lines of...</p>
  
  <ol>
  <li><p>You launch my app and use it until it makes a request from the app server that requires authentication. It responds to that request with a random token that the server will associate with you for a short time.</p></li>
  <li><p>The app presents you with a username field, a password field, and a submit button.</p></li>
  <li><p>You enter your username and password. The app then forwards your username and hashed password, along with the token generated by the app server, to the login service.</p></li>
  <li><p>The login service determines whether or not your username and password are valid. If they are, it digitally timestamps and signs the token, and returns the signed token to the app.</p></li>
  <li><p>The app relays the signed token to the server.</p></li>
  <li><p>The server checks the signature, satisfies itself that it's valid and signed by an authority it trusts, and proceeds as though the user had presented IT with a valid local username and password instead.</p></li>
  </ol>
  
  <p>I suspect I'm just getting lost in nomenclature, but the impression I've gotten so far is that all the usual SSO providers -- Twitter, Facebook, etc -- only allow users to log in using a normal browser, and that you're either not allowed to do what I described, or they do something to make it effectively impossible with anything besides a normal browser (like dynamically creating the login form via Javascript in an effort to prevent developers from trying to use their own apps as a login facade).</p>
  
  <p>Alternatively, does there exist any workflow like THIS...</p>
  
  <ol>
  <li><p>You launch my app and use it until the web service requires you to log in. The app server generates a token and returns it to the app.</p></li>
  <li><p>The app spawns a new browser via intent that sends you to the login provider's web site, passing the token via intent to the browser (and ultimately the provider) as a POSTed formvar.</p></li>
  <li><p>You log in using the browser window, and the browser window closes -- returning you to my app.</p></li>
  <li><p>The login provider signs the token, then sends it directly to my app server via HTTP POST so I can note its submission, verify the cert, and treat it as though it were instead a valid username and password submitted directly by the user to the app server himself.</p></li>
  </ol>