function login(request, response){
  var googleOAuth2 = require('GoogleOAuth2').OAuth2;
  var ApiData = require('ApiAppData.js');
  var OAuth2 = new googleOAuth2(
    ApiData.client_id,
    ApiData.client_secret,
    ApiData.redirect_uri,
    {scope:ApiData.scope,
      approval_prompt:ApiData.approval_prompt
    }
  )
  var theQuery = getURLQuery(request.url);
  var code = theQuery.code;
  if (code) {
    result = googleOAuth2Login(code,OAuth2);
    if (result) {
      response.statusCode = 307;
      response.headers.Location = "/";
    }else{
      response.contentType = 'text/html';
      response.body = '<html><body>sorry - login failed</body></html>';
    }
  }else{		
    response.contentType = 'text/html';
    response.body = '<html><body>Please <a href="';
    response.body = response.body + OAuth2.getAuthenticateURL();
    response.body = response.body + '">Login with Google</a>.</body></html>';
  }
}

function googleOAuth2Login(code, OAuth2){

  function getGoogleUserInfo( accessToken ){
    var xhr = new XMLHttpRequest();
    xhr.open('GET','https://www.googleapis.com/oauth2/v1/userinfo?access_token=' + accessToken, false);
    xhr.send();
    return JSON.parse( xhr.responseText );
  }

  currentSession().promoteWith('Admin');
  var accessData, userInfo, person;
  accessData = OAuth2.getAccessData(code); 
  
  if (accessData.error) {
    return false;
  }

  userInfo = getGoogleUserInfo(accessData.access_token);

  if (userInfo && userInfo.error){
    return false;
  }
  person = ds.Person.find("ID = :1", userInfo.id);
    
  if (!person) {
    person = new ds.Person({ID:userInfo.id});
  }
  person.firstName= userInfo.given_name;
  person.lastName= userInfo.family_name;
  person.email= userInfo.email;

  if(userInfo.picture){
    person.picture = userInfo.picture;
  }

  person.save();

  createUserSession({
    ID: person.ID,
    name: person.email, 
    fullName: person.fullName, 
    belongsTo: ["User"]
  })


  currentSession().unPromote();

  return person;
}

@@ -91,180 +91,224 @@
 var 
-ApiData = require('ApiAppData.js');%0A  var OAuth2 = new googleOAuth2(%0A    ApiData.client_id,%0A    ApiData.c
+OAuth2 = new googleOAuth2(%0A    %22Your Google ClientID....apps.googleusercontent.com%22,%0A    %22Your Google C
 lient
-_s
+S
 ecret
+%22
 ,%0A    
-ApiData.redirect_uri,%0A    %7Bscope:ApiData.scope
+%22http://127.0.0.1:8081/%22,%0A    %7Bscope:%22email https://www.googleapis.com/auth/userinfo.profile%22
 ,%0A
- 
     
@@ -328,31 +328,16 @@
 mpt:
-ApiData.approval_prompt
+ %22force%22
 %0A   

add google API notes