Tuesday, November 19, 2013

How do I: Use Google App Engine to create a HTML page that gets and OAuth 2.0 token

Part 1:

- Sign-up for Google app engine and create an app
- Download Google app engine for Python
- Download Python 2.7 (new versions will not work)
- Download this website.zip


<html>
  <head>
    <script src="https://apis.google.com/js/client.js"></script>
    <script>
      function auth() {
        var config = {
      'client_id': '1047208262160-97aage5bp7m6luurm8qrl4c7nq77om89',
          'scope': 'https://www.googleapis.com/auth/plus.me'
        };
        gapi.auth.authorize(config, function() {
          console.log('login complete');
          console.log(gapi.auth.getToken());
        });
      }
    </script>
  </head>
  <body>
    <button onclick="auth();">Authorize</button>
  </body>
</html>

Part 2: Authorizing using OAuth 2.0 and getting a token

No comments:

Post a Comment