Last active
March 8, 2016 21:45
-
-
Save DLesage25/4c69d2a6dd24b0961825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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