Created
March 10, 2016 17:41
-
-
Save wf9a5m75/14928592ce63cf2aafd9 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
var CLIENT_ID = "" | |
var CLIENT_SECRET = "" | |
var REDIRECT_URL = "" | |
var REFRESH_TOKEN = ""; | |
var async = require('async'); | |
var google = require('googleapis'); | |
var OAuth2 = google.auth.OAuth2; | |
var oauth2Client = new OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL); | |
oauth2Client.setCredentials({ | |
refresh_token: REFRESH_TOKEN | |
}); | |
google.options({ auth: oauth2Client }); // set auth as a global default | |
var drive = google.drive({ version: 'v2', auth: oauth2Client }); | |
async.waterfall([ | |
function(next) { | |
drive.files.list(next); | |
}, | |
function(result, response, next) { | |
drive.files.get({ | |
fileId: result.items[0].id | |
}, next); | |
} | |
], function(error, result, response) { | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment