Firestore Authentication 用户元数据存储位置问题咨询
这些元数据存储在Firebase Authentication服务本身的专属存储中,并不属于Firestore、Cloud Storage等其他独立的Firebase/GCP存储产品,你没有在其他存储服务中找到是正常情况。
- 你在Firebase控制台的Authentication用户列表页只能看到
Identifier、Providers等核心字段,是因为列表视图做了精简,你点击任意单个用户进入详情页,就能看到displayName、头像URL这类可编辑的元数据字段,和你代码中读取的属性完全对应。 - 你通过
getAuth()获取用户对象时,Firebase Auth SDK会直接和Auth服务的底层存储通信拉取全量用户数据,同时会自动将数据缓存到客户端本地(浏览器环境下默认存储在IndexedDB或LocalStorage中),减少后续请求的开销。 - 如果需要修改这类用户元数据,可以直接调用Auth SDK提供的
updateProfile方法,修改的就是Auth服务内部存储的对应数据,示例如下:
import { getAuth, updateProfile } from "firebase/auth"; const auth = getAuth(); await updateProfile(auth.currentUser, { displayName: "自定义用户名", photoURL: "https://example.com/user-avatar.jpg" })
内容的提问来源于stack exchange,提问作者engineer-x
相关产品推荐
相关产品推荐

