验证代码未出现在React Native的Firebase登录中

时间:2019-11-11 13:43:36

标签: firebase react-native firebase-realtime-database redux firebase-authentication

我正在通过Firebase电话号码实施登录方法,应该在其中接收otp。我已经正确实施了。

export const phoneauth = () => {
    return async (dispatch, getState) => {
        try {
            const {
                phone
            } = getState().user
            firebase.auth().signInWithPhoneNumber(phone)
                .then(confirmResult => this.setState({
                    confirmResult,
                    message: 'Code has been sent!'
                }))
                .catch(error => this.setState({
                    message: `Sign In With Phone Number Error: 
        ${error.message}`
                }));
            dispatch(getUser(response.user.uid))
        } catch (e) {
            alert(e)
        }
        if (response.user.uid) {
            console.log(user)
            alert(error.message)

            const user = {
                uid: response.user.uid,
                phone: phone
            }

            db.collection('users')
                .doc(response.user.uid)
                .set(user)

            dispatch({
                type: PHONE,
                payload: user
            })
        }

    }
}

我没有任何错误。

0 个答案:

没有答案