[英]How to get the user Record using the google-cloud firestore auth by getUserByPhoneNumber?
I have to extract data from the user using auth by phone Number.我必须通过电话号码使用身份验证从用户那里提取数据。 I have an array of user's phone number.我有一组用户的电话号码。
I have written a solution and it gives the required output but it doesn't terminate.我写了一个解决方案,它提供了所需的输出,但它不会终止。 How can I solve this problem?我怎么解决这个问题?
"phoneNumberArray" is the array of user's phone number. “phoneNumberArray”是用户电话号码的数组。 It is mostly related to HTTP background trigger functions.I have solved this but this is a firebase issue so please see this它主要与 HTTP 后台触发器功能有关。我已经解决了这个问题,但这是一个 firebase 问题,所以请看这个
const user = async () => {
const getAuth = async phoneNumber => {
return auth.getUserByPhoneNumber(phoneNumber).catch(() => {
return {
phoneNumber,
uid: null,
email: '',
displayName: '',
emailVerified: false,
disabled: false,
};
});
};
const userRecord = await Promise.all(
phoneNumberArray.map(phoneNumber => {
return getAuth(phoneNumber);
}),
);
//when i console.log(userRecord) it's print the output
const x = {
'userRecord Length': userRecord.length
}
console.log(x)
return;
}
module.exports = {user}
I have used this way to solve the function.我已经使用这种方式来解决该功能。
in the main file i have to return
return x,admin;
and the calling file works like this
const {user} = require('./filename');
user().then(e => {
console.log(e.x)
e.admin.apps[0].delete();
})catch(error){
console.log(error)}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.