Firbase 云功能在 Express .Js 中具有基于角色的身份验证

问题描述 投票:0回答:1

我需要了解如何将基于角色的身份验证与 firebase 云功能结合使用。我正在尝试使用express.js 来查找。如果您有任何明确的文档、gitrepos、任何来源的链接,请与我分享。

express google-cloud-firestore firebase-authentication google-cloud-functions role-base-authorization
1个回答
0
投票

我认为您想使用管理 SDK 检查来电

role
https

如果我理解正确,那么下面是使用 custom-claim

的代码块
// Verify the ID token first.
getAuth()
  .verifyIdToken(idToken)
  .then((claims) => {
    if (claims.admin === true) {
      // Allow access to requested admin resource.
    }
  });

请参阅 custom-claims#set_and_validate_custom_user_claims_via_the_admin_sdk

© www.soinside.com 2019 - 2024. All rights reserved.