小编Ric*_*cky的帖子

Google Firebase 身份验证在 Netlify 上失败,但在本地服务器上工作

当我将网站部署到 netlify 时,我无法正确登录,新的 google 窗口自动打开和关闭,我的网站时钟

function SignIn() {
const signInWithGoogle = () => {
  const provider = new firebase.auth.GoogleAuthProvider();
  auth.signInWithPopup(provider);
};

return (
  <>
    <button className="sign" onClick={signInWithGoogle}>
      Sign in with Google
    </button>
  </>
);
Run Code Online (Sandbox Code Playgroud)

}

function SignOut() {
return (
  auth.currentUser && (
    <button className="sign" onClick={() => auth.signOut()}>
      Sign Out
    </button>
  )
);
Run Code Online (Sandbox Code Playgroud)

}

图片

只有在我将其部署到netlify上后,它才会在Web中发生,并且在本地服务器中正常工作

firebase reactjs firebase-authentication netlify

4
推荐指数
1
解决办法
3891
查看次数