Firebase 云函数 EventContext.auth(迁移指南) [英] Firebase Cloud Functions EventContext.auth (Migration Guide)

查看:12
本文介绍了Firebase 云函数 EventContext.auth(迁移指南)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循Firebase SDK for Cloud Functions 迁移指南"并且在将文件上传到云存储后集成新属性以获取用户身份验证信息时遇到问题.

I followed along the "Firebase SDK for Cloud Functions Migration Guide" and had problems integrating the new properties to get the user auth information after uploading a file to the cloud storage.

exports.processFile = functions.storage.object().onFinalize((object, context) => {
  console.log('Uploaded ', object, context);
});

从上面的代码片段可以看出,我已经切换到 onFinalize 方法.object 参数包含对上传文件进行重新分级的所有信息.但是上下文是空的.

我想知道如何使用新属性 EventContext.auth 检索用户的身份验证令牌,如此处所示.用户身份验证信息的新属性

As it can be seen in the snippet above, I have switched to the onFinalize method. The object parameter contains all information regrading the uploaded file. However the context is empty.

I am wondering how to retrieve the user's auth token with the new properties EventContext.auth as shown here. New properties for user auth information

推荐答案

不会自动将有关将文件写入存储的用户的信息传递给您的云函数.如果你需要这些信息,通常将其传递到文件的路径中.

No information about the user that write the file to storage is passed to your Cloud Function automatically. If you need such information, it is common to pass it into the path of the file.

实时迁移文档中描述的属性数据库触发器仅适用于从实时数据库触发的 Cloud Functions.它们不适用于存储触发器.

The properties described in the migration documentation for realtime database triggers only apply to Cloud Functions that are triggered from the Realtime Database. They do not apply to Storage triggers.

这篇关于Firebase 云函数 EventContext.auth(迁移指南)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆