gcloud-node to access bearer token?

178 views Asked by At

will the gcloud-node API give me the bearer token it is using?

I'm able to create signed urls with gcloud-node and the keyfile.json 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.

1

There are 1 answers

1
navicore On BEST ANSWER

answered on github: https://github.com/GoogleCloudPlatform/gcloud-node/issues/818

answer: yes, but not officially supported

var reqOpts = { uri: '...' }; // what you would pass to the request module

storage.makeAuthorizedRequest_(reqOpts, {
  onAuthorized: function(err, authorizedReqOpts) {
    // authorizedReqOpts.headers.Authorization = 'bearer token'
  }
});