Published using Google Docs
Making the API request
Updated automatically every 5 minutes

function logIn() {

        gapi.client.load('plus', 'v1', function() {

          var request = gapi.client.plus.people.get({

            'userId': 'me'

          });

          request.execute(function(resp) {

            var heading = document.createElement('h4');

            var image = document.createElement('img');

            image.src = resp.image.url;

            heading.appendChild(document.createTextNode(resp.displayName));

            heading.appendChild(image);

            document.getElementById('logIn').appendChild(heading);

          });

        });

      }