从云功能获取用户的uid

时间:2020-06-17 06:17:25

标签: google-cloud-firestore google-cloud-functions

我正在尝试获取用户的uid,该uid在已更改的文档的路径中,但不确定如何从该路径中提取它?

  exports.watchTodos = functions.firestore.document('users/{uid}/todos/{docId}')
        .onUpdate(async (snap, context) => {
            // get the uid of the user
            const uid = await context.auth?.uid
            console.log(uid)
  }

0 个答案:

没有答案