谷歌登录弹出窗口不会持续很长时间,或者显示“请求的操作无效”

Rao*_*uer 8 javascript google-authentication firebase-authentication

我有一个 firebase web 应用程序,谷歌登录弹出窗口不起作用,它不会持续或给我一条消息(检查图片)是否有解决方案

//sign in with google
const googleProvider = new GoogleAuthProvider();
const signInWithGoogle = document.querySelector('#google-icon');
signInWithGoogle.addEventListener('click', (e) => {
e.preventDefault();
signInWithPopup(auth, googleProvider).then((result) => {
 const user = result.user;
 const credential = GoogleAuthProvider.credentialFromResult(result);
 const accessToken = credential.accessToken;})
 .catch((error) => {
   const errorCode = error.code;
   const errorMessage = error.message;
   const email = error.email;
   const credential = GoogleAuthProvider.credentialFromError(error);
 });
});
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Ice*_*bon 5

我在使用 firebase auth 时遇到了同样的问题。我的问题是http://127.0.0.1:3000/未授权。

firebase 授权域

当我切换到http://localhost:3000/后,一切正常。