gcloud-node 访问不记名令牌?

gcloud-node to access bearer token?

gcloud-node API 会给我它正在使用的不记名令牌吗?

我可以使用 gcloud-node 和 keyfile.json 创建签名 url,但我正在尝试遵循 resumable download docs。他们建议在服务器上开始上传并将 session 传递给客户端。看起来很简单,除了 header:

Authorization: Bearer your_auth_token

我可以在某种初始化之后做类似 gcs.getAuth 的事情吗?

感谢任何帮助。

在 github 上回答:https://github.com/GoogleCloudPlatform/gcloud-node/issues/818

回答:是的,但官方不支持

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

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