Skip to content

Instantly share code, notes, and snippets.

@DLesage25
Last active March 8, 2016 21:45
Show Gist options
  • Save DLesage25/4c69d2a6dd24b0961825 to your computer and use it in GitHub Desktop.
Save DLesage25/4c69d2a6dd24b0961825 to your computer and use it in GitHub Desktop.
module['exports'] = function echoHttp (hook) {
console.log(hook.params);
console.log(hook.req.path);
console.log(hook.req.method);
console.log(hook.env);
// var gapi = require( 'google-client-api' );
//var APIkey = 'AIzaSyB7rMpkdPhMosiCCnBgpt_owvL6aHMKB9k';
var clientID = '790426025496-l48jfsvd934krpej44t6gi76o0cpq04c.apps.googleusercontent.com';
var CLIENT_SECRET = 'my_KuLpNa2C4KAGNIYsTijKO';
//gapi.client.setApiKey(APIkey);
//gapi.client.load('drive', 'v3').then(function() {
// hook.res.end(JSON.stringify("Loaded.", true, 2));
//});
var REDIRECT_URL = 'http://www.google.com';
var google = require('googleapis');
var OAuth2 = google.auth.OAuth2;
var oauth2Client = new OAuth2( clientID, CLIENT_SECRET, REDIRECT_URL);
// generate a url that asks permissions for Google+ and Google Calendar scopes
var scopes = [
'https://www.googleapis.com/auth/plus.me',
'https://www.googleapis.com/auth/calendar'
];
var url = oauth2Client.generateAuthUrl({
access_type: 'offline', // 'online' (default) or 'offline' (gets refresh_token)
scope: scopes // If you only need one scope you can pass it as string
});
//hook.res.end(JSON.stringify(hook.params, true, 2));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment