【问题标题】:How can we include app check tokens in sending Firestore REST Api requests?我们如何在发送 Firestore REST Api 请求时包含应用检查令牌?
【发布时间】:2022-11-21 05:37:59
【问题描述】:

我为我的 Firebase 应用程序创建了一个自定义 Firebase App Check 提供程序。我的问题是,在从我的自定义应用程序检查中获取令牌后,如何使用 Firestore REST API 正确发送成功的请求。谢谢!

【问题讨论】:

    标签: firebase google-cloud-firestore firebase-app-check


    【解决方案1】:

    您需要像这样在请求的标头中设置 appCheck 令牌

    // Include the App Check token with requests to your server.
      const apiResponse = await fetch('https://yourFirebaseRestApiURL/Endpoint', {
          headers: {
              'X-Firebase-AppCheck': appCheckTokenResponse.token,
          }
      });
    

    这在 Firestore Rest API 中没有记录,但在 AppCheck 文档中 https://firebase.google.com/docs/app-check/web/custom-resource

    【讨论】:

      猜你喜欢
      • 2015-09-18
      • 2021-11-27
      • 2018-11-15
      • 1970-01-01
      • 1970-01-01
      • 2020-06-17
      • 2021-08-13
      • 2015-12-06
      • 1970-01-01
      相关资源
      最近更新 更多