在身份验证触发器上,我将displayName设置为null [英] On authentication triggers I am getting displayName as null
本文介绍了在身份验证触发器上,我将displayName设置为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在身份验证触发器上使用用户数据.但是,当我使用它们时,它使我为零.我的代码有什么问题?
I want to use users data on authentication trigger. But when I am using them it gives me null. What is wrong with my code?
exports.sendWelcomeMessage = functions.auth.user().onCreate((user) => {
const name = user.displayName;
console.log(name);
return null;
})
推荐答案
我推测您正在创建用户,然后设置显示名称(例如,通过2个调用).
I speculate you are creating the user and then setting the display name (eg via 2 calls).
onCreate
,例如 createUserWithEmailAndPassword
.
当您调用 updateProfile
设置 displayName
时,onCreate事件将已经触发.
When you call updateProfile
to set the displayName
, the onCreate event would have already been triggered.
这篇关于在身份验证触发器上,我将displayName设置为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文