Firebase登录并重定向

时间:2018-11-21 09:56:40

标签: javascript firebase firebase-authentication

我正在使用Firebase和Redirect登录。在这里,第4行的代码不起作用,我在哪里弄错了?

export const startLogIn = () =>{
return () => {
    firebase.auth().signInWithRedirect(googleAuthProvider);
    return firebase.auth().getRedirectResult()
            .then(result => {
                console.log(result);
                const profile = result.user;
                const user = {
                    uid : profile.uid,
                    name : profile.displayName,
                    avatar : profile.photoURL
                }
                if(result.additionalUserInfo.isNewUser){
                    axios.post(`http://localhost:5000/api/user`, user)
                        .then(res => {
                            console.log(res.data);

                        });
                }
            });
 };
 };

0 个答案:

没有答案