I've unsuccessfully scoured the internet for an example of how to authenticate against Google APIs using node and the Bot Framework emulator. I've got as far as calling the Google login but have no idea how to capture the authorisation code back in the bot. I am using the npm module googleapis. The code so far:
var google = require('googleapis');
var OAuth2Client = google.auth.OAuth2;
var plus = google.plus('v1');
var CLIENT_ID = "xxx.apps.googleusercontent.com";
var CLIENT_SECRET = "xxx";
var REDIRECT_URL = 'http://localhost:3978'; // Not sure about this!
var oauth2Client = new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
var url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: 'https://www.googleapis.com/auth/drive'
});
The url generated takes me to the Google login page. From there, I haven't been able to make any progress. I've tried https://github.com/google/google-api-nodejs-client/blob/master/samples/oauth2.js and a few other examples but none that use the bot framework. I am unclear as to how to retrieve the authentication code in the bot once I allow access on the Google authentication web page. Any guidance is appreciated.