如何通过getUserByPhoneNumber使用google-cloud firestore auth获取用户记录?

问题描述 投票:0回答:1

我必须通过电话号码使用auth从用户中提取数据。我有一组用户的电话号码。

我已经编写了一个解决方案,它提供了所需的输出,但是没有终止。我该如何解决这个问题?

“ phoneNumberArray”是用户电话号码的数组。它主要与HTTP后台触发功能有关。

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;
}
node.js firebase-authentication google-cloud-functions es6-promise firebase-admin
1个回答
0
投票

我在其他文件中这样调用了此函数常量用户= require(./文件名)user()

© www.soinside.com 2019 - 2024. All rights reserved.