<!-- The top of file index.html -->
<html itemscope itemtype="http://schema.org/Article">
<head>
  <!-- BEGIN Pre-requisites -->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
  </script>
  <script src="https://apis.google.com/js/client:platform.js?onload=start" async defer>
  </script>
  <!-- END Pre-requisites -->
<!-- Continuing the <head> section -->
  <script>
    function start() {
      gapi.load('auth2', function() {
        auth2 = gapi.auth2.init({
          //client_id: 'YOUR_CLIENT_ID.apps.googleusercontent.com',
          client_id: '512268687331-6t93vg67gvr12lc6uqaf55e82ic52dnj.apps.googleusercontent.com'
        });
      });
    }
  </script>
</head>
<body>
  <!-- ... -->
<!-- Add where you want your sign-in button to render -->
<!-- Use an image that follows the branding guidelines in a real app -->
This is used to generate an access token using a brand-new project and
client ID.<br>
<button id="signinButton">Sign in with Google</button>
<script>
  $('#signinButton').click(function() {
    auth2.grantOfflineAccess({'redirect_uri': 'postmessage'}).then(signInCallback);
  });
</script>
<div id="result"></div>
<!-- Last part of BODY element in file index.html -->
</body>
</html>
<script>
function signInCallback(authResult) {
  console.log("Doing the sign in callback");
  if (authResult['code']) {

     $.ajax({
          type: 'POST',
          url: 'http://localhost:8080/openhmis/api/v3/authenticate/google',
          contentType: 'application/octet-stream; charset=utf-8',
          processData: false,
          data: authResult['code'],
          success: function(result) {
              console.log("Success!");
              result = JSON.parse(result);
              var id_token = result["id_token"];
              $("#result").html("Your id token is: " + id_token + "<br><br> Pass this as the content of the Authorization header in requests to the API.");
          },
          error: function(error) {
              console.log("Error...");
              $("#result").html("An error occurred: " + error.responseText);
          }
          });
      } else {
          $("#result").html("Sorry, there was an error generating your id token.");
      }
};

</script>

Add route so new users can find their id_token
Add route so new users can find their id_token

Simplify the process for getting the id_token.  This still needs to read
the client id from the properties file.  All the javascript needs to be
moved into a separate file, and I'll add more styling.  This code mostly
comes from Google's [example
flow](https://developers.google.com/identity/sign-in/web/server-side-flow).
Once this is done I'll update the documentation accordingly.
