【问题标题】:Can i make my cdn directly contact firebase storage with the token then return the file only not the token?我可以让我的 cdn 使用令牌直接联系 firebase 存储,然后只返回文件而不返回令牌吗?
【发布时间】:2021-08-07 16:26:04
【问题描述】:

所以我需要 cdn.ex.com/avatars/:UserID 指向我的云私有文件 URI,即 https://cloudapi.com/account.cloud.com/files/uploads/avatars/(userid)/avatar.png?token=${genNewTok()}(放置真实 URL) 除了

,我还没有任何代码
app.get('/avatars/:userid', (req, res)=>{
    let userid = req.params.userid
    let uri = `https://cloudapi.com/account.cloud.com/files/uploads/avatars/${userid}/avatar.png?token=${genNewTok()}`

});

所以我应该可以在 html 中做:

<span>Username</span>
<img class="pfp" src="cdn.ex.com/avatars/671856275627525">

而不是不得不做

<span>Username</span>
<img class="pfp" src="https://cloudapi.com/account.cloud.com/files/uploads/avatars/671856275627525/avatar.png">

有什么帮助吗?

【问题讨论】:

    标签: node.js firebase express firebase-storage cdn


    【解决方案1】:

    我找到了答案。 您需要访问 metadata.metadata.firebasetokenthingy 并将其添加到 uri。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-09
      • 2018-08-02
      • 2019-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多