These samples allow you to list, download, and upload files from Google Drive.
Set the following values in oauth2.keys.json (up one directory) under the web key:
redirect_urisclient_idproject_idclient_secret
Your file should look like this:
{
"web" : {
"redirect_uris": ["http://localhost:3000/oauth2callback"],
"client_id": "<YOUR_CLIENT_ID>",
"client_secret": "<YOUR_CLIENT_SECRET>",
"project_id": "<YOUR_PROJECT_ID>"
}
}Run the quickstart.js sample:
This sample will list the files in the user's Google Drive.
You'll need to do the following before you can run this sample:
- Enable the Google Drive API.
- Set the redirect API in the Google Cloud Console application registration to
http://localhost:3000/oauth2callback.
node quickstart.jsRun the download.js sample:
Run the quickstart.js sample to get a list of files in your Google Drive.
node download.js <fileId>where <fileId> is the id of any file in Google Drive.
Example:
node download.js 0B_Klegupc5gUcXhFZjZVUV9NeE0Run the export.js sample:
node export.js <fileId>=where <fileId> is the id of a Google Doc in Google Drive.
Example:
node export.js 0B_Klegupc5gUcXhFZjZVUV9NeE0 ./file.pdf