oauth client

A boilerplate code

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="author" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> -->
  <link rel="stylesheet" href="index.css">
  <!--[if lt IE 9]>
      <script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
  <link rel="shortcut icon" href="">
</head>
<body>

  <button onclick="hello('google').login()">google</button>
  <button onclick="hello('google').logout()">logout</button>
  <!-- SCRIPTS -->
  <!--
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
      <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
      -->
  <script src="hello.all.js"></script>
  <script>
    hello.init(
      {google: "516591458871-s6jr870dbt8ep543258oaaofsl3v189v.apps.googleusercontent.com"}
    );
  </script>

  <script>
    hello.on('auth.login', function (auth) {

      hello(auth.network).api('/me').then(function (r) {
        console.log(JSON.stringify(r));
        debugger;
        var lab = document.createElement("div");
        lab.id = "pic_and_greet";
        lab.innerHTML = '<img src="' + r.thumbnail + '" /> Hey ' + r.name + '<p>'+r.aboutMe;
        document.body.appendChild(lab);
      });
    });

    hello.on('auth.logout', function () {
      var lab = document.getElementById("pic_and_greet");
      if (lab != null) document.body.removeChild( lab );
    });

  </script>

</body>
</html>

Spin up a local server

# Simple Server (to test it locally): 
$ python -m SimpleHTTPServer 5000

# Following aren't required

# Chrome Disable Security: 
$ open -a Google\ Chrome --args --disable-web-security --user-data-dir

# install pip: 
$ sudo easy_install pip

# install virtualenv: 
$ pip install virtualenv virtualenvwrapper