【问题标题】:gcloud-node to access bearer token?gcloud-node 访问承载令牌?
【发布时间】:2015-08-23 23:58:24
【问题描述】:

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

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

Authorization: Bearer your_auth_token

我可以在某种初始化之后执行 gcs.getAuth 之类的操作吗?

感谢任何帮助。

【问题讨论】:

    标签: gcloud-node


    【解决方案1】:

    在 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'
      }
    });
    

    【讨论】:

    猜你喜欢
    • 2021-10-09
    • 1970-01-01
    • 1970-01-01
    • 2018-03-20
    • 2021-09-01
    • 2016-11-28
    • 1970-01-01
    • 2018-07-14
    • 2021-09-16
    相关资源
    最近更新 更多