GeezerVison is showing github.com — Authorization: Bearer your_auth_token (how to get auth_token) · Issue #818 · googleapis/google-cloud-node
Authorization: Bearer your_auth_token (how to get auth_token) #818Descriptionquestion: will the API give me the bearer token it is using?
I'm able to create signed urls with gcloud-node but I'm trying to follow the resumable download docs. they suggest starting an upload on the server and passing the session to the client. looks easy except for the header:
Authorization: Bearer your_auth_token
can i do something like gcs.getAuth after some kind of init?
thx for any help. Activitystephenplusplus commented on Aug 24, 2015 We don't have this officially supported, but there's an opening if you go through some private properties.
With your Storage instance, try:
var reqOpts = { uri: '...' }; // what you would pass to the request module
storage.makeAuthorizedRequest_(reqOpts, {
onAuthorized: function(err, authorizedReqOpts) {
// authorizedReqOpts.headers.Authorization = 'bearer token'
}
});
I also made a module for exactly this which uses the same authorization settings as this library: https://github.com/stephenplusplus/google-auto-auth
I think our library could eventually add support for just starting a resumable upload, handing off the responsibility to the user to see it through. We currently support resumable uploads, but wrap the whole thing and hide away the details. jgeewax commented on Aug 24, 2015 Can we maybe create a ticket to allow this...?
Resumable upload seems like a pretty reasonable thing to build... no? stephenplusplus commented on Aug 24, 2015 Sure, new ticket it is. Thanks for bringing this issue up, @navicore! navicore commented on Aug 24, 2015 stephenplusplus commented on Aug 31, 2015 @navicore Since this issue, I moved all of our resumable logic into gcs-resumable-upload. You can use it to just get a resumable URI:
var upload = require('gcs-resumable-upload');
upload.createURI({
bucket: 'bucket-name',
file: 'file-name',
authConfig: {
// how you normally auth to gcloud, ex:
keyFilename: 'keyfile.json'
}
}, function (err, uri) {});gotmikhail commented on Feb 1, 2016 Is there the option to set the origin with this method? We're trying to use our API to generate a resumable uri, but the client is running on a different subdomain. stephenplusplus commented on Feb 1, 2016 I think @janesconference was going to help us implement that in gcs-resumable-upload. I opened an issue about it here: googleapis/gcs-resumable-upload#6. Feel free to subscribe to that one to track the progress. gotmikhail commented on Feb 1, 2016 @stephenplusplus Any other options? Ie., createWriteStream? Or, is it that setting the origin option isn't available right now at all? stephenplusplus commented on Feb 1, 2016 I don't believe any other options exist, sadly. I'll work on adding support asap.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|