Drive download returning token JSON object
See original GitHub issueHello, I’m having a problem downloading from the Drive using this API (v3). The data returned from the API is of the form:
{
"access_token" : "HUGE_TOKEN_STRING",
"token_type" : "Bearer",
"expires_in" : 3600
}
My code is roughly as follows (parts ommited due to confidentiality reasons):
var buffer = new Buffer(0);
drive.files.get({
auth: auth,
alt: 'media',
fileId: id,
})
.on('error', function (err) {
logger.error("Error " + err);
callback(err, null);
})
.on('data', function (data) {
logger.info("Got data!");
buffer = Buffer.concat([buffer, data], buffer.length + data.length);
})
.on('end', function () {
logger.info("End event!");
callback(null, buffer);
});
auth is an object created using a derivation of this example: https://developers.google.com/drive/v3/web/quickstart/nodejs#step_3_set_up_the_sample
Am I doing something wrong, or has the API changed somehow?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:27 (8 by maintainers)
Top Results From Across the Web
Google Drive API returning [Object] - node.js
You want to achieve this using googleapis@39.0.0 for Node.js. You have already been able to download a file from Google Drive using Drive...
Read more >Download files | Google Drive
To download a file stored on Google Drive, use the files.get method with the ID of the file to download ... import com.google.api.client.googleapis.json....
Read more >HTTP status and error codes for JSON | Cloud Storage
Cloud Storage uses the standard HTTP error reporting format for the JSON API. Successful requests return HTTP status codes in the 2xx range....
Read more >Authorize send requests | Firebase Cloud Messaging - Google
To mint this token, you can use Google Application Default Credentials (in ... need to download a service account JSON file from your...
Read more >Net-Google-Drive-Simple-0.17.readme
The script will then receive an access token from Google Drive and store it in ... is an object composed of the JSON...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I have similar issue. Turned out my problem was the access token getting expired. So I added a manual refresh before the oauth2Client callback in the node.js quickstart google api example link
replaced
by
Don’t know if it’s the best way but hope it helps.
I may need to re-open this issue, but I’d like to see if 12.4.0 works for anybody as far as the
encoding
goes. You should now be able to do: