0
我一直試圖使用Firebase Google Auth系統登錄Web應用程序以登錄用戶。我試圖在登錄時調用signInWithPopup()函數按鈕被點擊,但頁面仍然無法響應。似乎無法通過Firebase打開Google Popup
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Social Login Button</title>
<script>
//my Firebase initialization snippet
var config = {
apiKey: "AIzaSyBqscqBBOImd2QqtAWCl3VCuKNF4yNwmnc",
authDomain: "appvise-25c65.firebaseapp.com",
databaseURL: "https://appvise-25c65.firebaseio.com",
storageBucket: "appvise-25c65.appspot.com"
};
firebase.initializeApp(config);
</script>
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase-app.js"> </script>
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase-database.js"></script>
<script>
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
</script>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
這是頁面的實際標記。
<div class="login-box">
<h2>Social Login Button</h2>
<a href="#" class="social-button" id="facebook-connect" > <span>Connect with Facebook</span></a>
<a href="#" class="social-button" id="google-connect" onclick="signInWithPopup()" > <span>Connect with Google</span></a>
<a href="#" class="social-button" id="twitter-connect"> <span>Connect with Twitter</span></a>
<a href="#" class="social-button" id="linkedin-connect"> <span>Connect with LinkedIn</span></a>
</div>
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>
</body>
</html>
當懸停signInWithPopup錯誤提示「未解決的功能或方法」彈出,即使火力地堡是貌似設置。
謝謝你的時間。